Location: PHPKode > projects > Content*Builder > contentbuilder/plugins/news_settings/settings.inc.php
<?php
	$query  = mysql_query("SELECT * FROM ".TABLE."_user WHERE name = '$HTTP_SESSION_VARS[user]'");
	$result = mysql_fetch_array($query);
	
	if(!(SET_GEN & $cbPerms) || !(SET_LOG & $cbPerms)) {
		if(!(ADMIN & $cbPerms)) {
			print($settingsError['permission']);
			exit();
		}
	}
	
	if(file_exists($lang_path.$lang_pf."/plugin/setting.lang.php")) {
		include($lang_path.$lang_pf."/plugin/setting.lang.php");
	} else {
		include($lang_path."en/plugin/setting.lang.php");
	}

	$tpl->assign("settingMessages", $settingsText);
	
	$settingPlugins = $cbPlugins->getPluginsByType("sub:setting");
	if($settingPlugins != false) {
		foreach($settingPlugins as $v) {
			if($v->getValue("visibility") != "hidden") {
				/* 
				* Wenn Name im Language Array abgelegt ist, nimm diesen, 
				* ansonsten den, den das Plugin angegeben hat
				*/
				if($lang_plugin_plugin[$v->getValue("ident")] != "") {
					$settingPluginNames[] = $lang_plugin_plugin[$v->getValue("ident")];
				} else {
					$settingPluginNames[] = $v->getValue("name");
				}
				
				$settingPluginIdents[] = $v->getValue("ident");
				
				/* 
				* Herausfinden ob ein Tab gerade gewählt ist
				*/
				if($v->getValue("ident") == $settingTab) {
					$settingPluginSelected[] = 1;
				} else {
					$settingPluginSelected[] = 0;
				}
			}
		}
	}
	
	$noSelect = 0;
	if(!isset($settingTab)) {
		$noSelect = 1;
	}
	
	$menuPrefix = '&nbsp;|&nbsp;';
		
	/*
	* Wenn kein Sub Plugin ausgewählt wurde, sollen nur die allgemeinen 
	* Optionen angezeigt werden
	*/
	if(empty($settingTab) || $settingTab == "general") {
		$myMedia   = new MediaManagement();
		$myMedia->userID = $HTTP_SESSION_VARS[user];
		$myMedia->setOptionObject($cbOption);
		
		if(!$cbOption->getSingleOption("generalMedia")) {
			$cbOption->insertOption('generalMedia', "");
		}
		if(!$cbOption->getSingleOption("commentHTMLallowed")) {
			$cbOption->insertOption('commentHTMLallowed', "0");
		}
		if(!$cbOption->getSingleOption("commentBBTagsallowed")) {
			$cbOption->insertOption('commentBBTagsallowed', "1");
		}
		if(!$cbOption->getSingleOption("portraitTID")) {
			$cbOption->insertOption('portraitTID', "");
		}
		if(!$cbOption->getSingleOption("artAmount")) {
			$cbOption->insertOption('artAmount', "10");
		}
		if(!$cbOption->getSingleOption("defaultEditor")) {
			$cbOption->insertOption('defaultEditor', "3");
		}
		if(!$cbOption->getSingleOption("skinDir")) {
			$cbOption->insertOption('skinDir', "templates/default/");
		}
		if(!$cbOption->getSingleOption("BTPL_location")) {
			$cbOption->insertOption('BTPL_location', "../");
		}
		if(!$cbOption->getSingleOption("BTPL_defaultTitle")) {
			$cbOption->insertOption('BTPL_defaultTitle', "Content*Builder Webfrontend");
		}
		if(!$cbOption->getSingleOption("BTPL_defaultKeywords")) {
			$cbOption->insertOption('BTPL_defaultKeywords', "cms, php, content, management");
		}
		
		include($pluginLocation.'/plugin.config');
	
		$link1 = $PHP_SELF.'?load='.$config["urlIdent"].'&'.SID;
		
		if(isset($save)) {
			if(!empty($artAmount)) {
				if(!ereg("(^[0-9]*$)", $artAmount)) { $artAmount = "10"; }
			}
			// zur Sicherheit das Modul noch mal setzen
			$cbOption->setModule("system");
			// einzelne Optionen in die DB eintragen
			$cbOption->updateOption('userlog',      $userlog);
			$cbOption->updateOption('errorlog',     $errorlog);
			$cbOption->updateOption('caching',      $caching);
			$cbOption->updateOption('user_self',    $user_self);
			$cbOption->updateOption('comment',             $comment);
			$cbOption->updateOption('commentHTMLallowed',  $commentHTML);
			$cbOption->updateOption('commentBBTagsallowed',$commentBBTags);
			$cbOption->updateOption('rate',         $rate);
			$cbOption->updateOption('lang',         $language);
			$cbOption->updateOption('maxfileup',    $maxfileup);
			$cbOption->updateOption('maxiconup',    $maxiconup);
			$cbOption->updateOption('artAmount',    $artAmount);
			$cbOption->updateOption('generalMedia', $generalMediaID);
			$cbOption->updateOption('portraitTID',  $portraitTypeID);
			$cbOption->updateOption('defaultEditor',$editorValue);
			$cbOption->updateOption('skinDir',      "templates/".$skinDirValue."/");
			$cbOption->updateOption('BTPL_location',        $BTPL_pathValue);
			$cbOption->updateOption('BTPL_defaultTitle',    $BTPL_defaultTitle);
			$cbOption->updateOption('BTPL_defaultKeywords', $BTPL_defaultKeywords);
			// aktuelle Liste aktualisieren		
			$cbOption->getOptionList();
			$upd = 1;
		}
		
		/*
		* Einstellungen für 'Allgemeine Medien' - Zweig  Auswahl
		*/
		$mediaTypeArray = $myMedia->getMediaTypes();
		$mediaPortrait[$cbOption->getSingleOption("portraitTID")] = "selected";
		$generalBranches  = $myMedia->getAllowedBranches("system");
		$mediaGeneralBranch[$cbOption->getSingleOption("generalMedia")] = "selected";
		
		if($mediaTypeArray) {
			foreach($mediaTypeArray as $k => $v) {
				$mediaTypeID[]		  = $k;
				$mediaPortraitSelect[] = $mediaPortrait[$k];
				$mediaTypeValue[]   = $v;
			}
		}
		
		$tpl->assign("portraitType",
			array ( "ID"       => $mediaTypeID,
					"SELECTED" => $mediaPortraitSelect,
					"VALUE"    => $mediaTypeValue
			)
		);
		
		if($generalBranches) {
			foreach($generalBranches as $k => $v) {
				$mediaBranchID[]      = $k;
				$mediaBranchSelect[]  = $mediaGeneralBranch[$k];
				$mediaBranchValue[]   = $v;
			}
		}
		
		$tpl->assign("generalBranch",
			array ( "ID"       => $mediaBranchID,
					"SELECTED" => $mediaBranchSelect,
					"VALUE"    => $mediaBranchValue
			)
		);
		/* Allgemeine Medien Ende */
		
		/* Editor Auswahl */
		$defaultEditorSelected[$cbOption->getSingleOption("defaultEditor")] = "selected";
		// Row1
		$editor_value[]	 = 0;
		$editor_text[]   = "HTML";
		$editor_selected[] = $defaultEditorSelected[0];
		// Row 2
		$editor_value[]	 = 1;
		$editor_text[]   = "Extended Text (TAG-System)";
		$editor_selected[] = $defaultEditorSelected[1];
		// Row 3
		$editor_value[]	 = 2;
		$editor_text[]   = "Text-Only";
		$editor_selected[] = $defaultEditorSelected[2];
		// Row4
		$editor_value[]	 = 3;
		$editor_text[]   = "DHTML Editor";
		$editor_selected[] = $defaultEditorSelected[3];
		
		$tpl->assign("settingEditor",
			array ( "SELECTED" => $editor_selected,
					"NAME"     => $editor_text,
					"VALUE"    => $editor_value
			)
		);
		/* Editor Auswahl Ende */
		
		/* Skin Finder */
		$skinsDirArray  = array();
		$skinCounter    = 0;
		$dir2scan       = "templates/";
		$skinDir		= dir("templates/");
		while($skinDirEntry = $skinDir->read()) {
			$noInclude = false;
			if(is_dir($dir2scan.$skinDirEntry)) {
				if(file_exists($dir2scan.$skinDirEntry."/contentbuilder.template")) {
					$skinDirArray[] = $skinDirEntry;
					if($dir2scan.$skinDirEntry."/" == $cbOption->getSingleOption("skinDir")) {
						$skinDirSelected[] = "selected";
					} else {
						$skinDirSelected[] = "";
					}
					++$skinCounter;
				}
			}
		}
		$skinDir->close();
		$tpl->assign("settingSkin",
			array ( "SELECTED" => $skinDirSelected,
					"VALUE"    => $skinDirArray
			)
		);
		/* Skin Finder Ende */
		
		$tplsetting = array();
		if($cbOption->getSingleOption("userlog") == 1)	{ $tplsetting["ulog"]		= "checked"; }
		if($cbOption->getSingleOption("errorlog") == 1) { $tplsetting["errorlog"]  = "checked"; }
		if($cbOption->getSingleOption("caching") == 1)	{ $tplsetting["caching"]	= "checked"; }
		if($cbOption->getSingleOption("user_self") == 1){ $tplsetting["user_self"] = "checked"; }
		if($cbOption->getSingleOption("comment") == 1)	{ $tplsetting["comment"]	= "checked"; }
		if($cbOption->getSingleOption("commentHTMLallowed")   == 1)	{ $tplsetting["commentHTML"]	= "checked"; }
		if($cbOption->getSingleOption("commentBBTagsallowed") == 1)	{ $tplsetting["commentBBTags"]	= "checked"; }
		if($cbOption->getSingleOption("rate") == 1)		{ $tplsetting["rate"]		= "checked"; }
		if($cbOption->getSingleOption("lang") == "de") {
			$tplsetting["lang_de"] = "checked"; 
		} else {
			$tplsetting["lang_en"] = "checked"; 
		}
		$tpl->assign("settingGeneral",
			array(	"CHK_ULOG"		 => $tplsetting["ulog"],
					"CHK_ERRORLOG"   => $tplsetting["errorlog"],
					"CHK_CACHING"    => $tplsetting["caching"],
					"CHK_USERSELF"   => $tplsetting["user_self"],
					"CHK_COMMENT"    => $tplsetting["comment"],
					"CHK_COMMENT_HTML"   => $tplsetting["commentHTML"],
					"CHK_COMMENT_BBTAGS" => $tplsetting["commentBBTags"],
					"CHK_RATE"		   => $tplsetting["rate"],
					"CHK_LANG_DE"    => $tplsetting["lang_de"],
					"CHK_LANG_EN"    => $tplsetting["lang_en"],
					"VAL_BTPLPATH"   => $cbOption->getSingleOption("BTPL_location"),
					"VAL_BTPLTITLE"  => $cbOption->getSingleOption("BTPL_defaultTitle"),
					"VAL_BTPLKEYS"   => $cbOption->getSingleOption("BTPL_defaultKeywords"),
					"VAL_ARTAMOUNT"  => $cbOption->getSingleOption("artAmount"),
					"VAL_MAXFILEUP"  => $cbOption->getSingleOption("maxfileup"),
					"VAL_ICONUP"     => $cbOption->getSingleOption("maxiconup"),
					"LANG"			   => $cbOption->getSingleOption("lang")
			)
		);
	
		if(isset($save)) {
			if($upd) {
				$messageList[] = $settingsSuccess["settings_change"];
				cb_log(13);
			} else {
				$errorList[] = $settingsError["settings_change"];
			}
		}
		
		if(count($errorList) > 0) {
			$tpl->assign("errorSet", "1");
			$tpl->assign("errorList", $errorList);
		}
		
		if(count($messageList) > 0) {
			$tpl->assign("messageSet", "1");
			$tpl->assign("messageList", $messageList);
		}
		
		$mainMessageContent[] = $tpl->fetch($config['templates']."messages.template", null, "pluginSetting".$cbUserID);
		$mainPluginContent[]  = $tpl->fetch($config['templates']."news.template", null, "pluginUsr".$cbUserID);
	} else {
		/*
		* Einbinden eines Sub Plugins für Einstellungen, welches über $settingTab 
		* aufgerufen wurde
		*/
		ob_start();
			$settingPlugin = &$cbPlugins->getPluginByIdent($settingTab);
			if($settingPlugin != false) {
				require_once($settingPlugin->getValue("directory").$settingPlugin->getValue("file"));
			}
			$mainPluginContent[] = ob_get_contents();
		ob_end_clean();
	}
	
	$tpl->assign("plugin_menu_data",
		array ( "NO_TAB_SELECTED" => $noSelect,
				"PRE"             => $menuPrefix,
				"SELECTED"        => $settingPluginSelected,
				"SETTINGTAB"      => $settingPluginIdents,
				"MENUENTRY"       => $settingPluginNames,
				"ACTUALTAB"       => $settingTab
		)
	);
	
	$tpl->assign("pluginContent", $mainPluginContent);
	$tpl->assign("messageContent", $mainMessageContent);
	$tpl->display($config['templates']."plugin.template");

?>
Return current item: Content*Builder