Location: PHPKode > projects > Content*Builder > contentbuilder/plugins/article2/listXmlFiles.inc.php
<?php
	include($cbDirLib."CB_pageSplit.class.php");
	$link1 = $PHP_SELF.'?load='.$config["urlIdent"].'&'.SID;

	// Prüfung auf Userrechte
	// hier nehmen wir gleich die Vorgehensweise von artAdd2 ...
		//  Reading Article Content
	$select = mysql_query("SELECT mediaID, userID, title AS workingTitle, datetime, stage, parse, options, languages FROM ".TABLE."_art_general WHERE ide = '$id'");
	if(mysql_num_rows($select) > 0) { 
		$metaInfo = mysql_fetch_array($select);
		foreach($metaInfo as $k => $value) {
			${$k} = $value;
		}
	} else {
		$cancel = true;
		$errorList[] = $amText["wrongID"];
	}

/*  $select = mysql_query("SELECT * FROM ".TABLE."_art_content WHERE ide = '".$id."' AND language = '$language'");
	$articleQuery = mysql_fetch_array($select,MYSQL_ASSOC);
	foreach($articleQuery as $k => $value) {
		${$k} = $value;
	}
 */	
	$authorQuery = mysql_fetch_array(mysql_query("SELECT * FROM ".TABLE."_user AS user WHERE user.userid = '$cbUserID'"));
	if(($metaInfo['userid'] != $authorQuery['userid']) && !(MOD_ALL & $cbPerms) && !(ADMIN & $cbPerms)) {
		$cancel = true;
		$errorList[] = $amText["wrongUser"];
	}
// Ende security-Check ...	

	
// handling of delete actions ... but it looks really to easy :-/
	if((! $cancel)&& (isset($delbox))) {
		//foreach($delbox as $k => $v) {
		foreach($delbox as $v) {
			//trigger_error("\$v=".$v);
			unlink($v);
 		}
		cb_log(7);
	}

	// Ordner ermitteln, um Eingrenzung auf bestimmte Rubriken zu erwirken
/* 	$thisFolder = mysql_fetch_array(mysql_query("SELECT * FROM ".TABLE."_columns WHERE fid = '$art_oview_subf' ORDER BY fname ASC"));
	if(empty($thisFolder)) {
		$thisFname = $amText["art-all"];
	} else {
		$thisFname  = $amText["art-of-this"].$thisFolder['fname'];
	}

	$folderUp = "&subf=".$thisFolder['mfolder'];
	
	$fQuery = mysql_query("SELECT * FROM ".TABLE."_columns WHERE mfolder = '$art_oview_subf' ORDER BY fname ASC");
	$counter = 0;
	while($fResult = mysql_fetch_array($fQuery)) {
		$folderFid[$counter]  = $fResult['fid'];
		$folderName[$counter] = $fResult['fname'];
		++$counter;
	}	 */
	
	// XML-Datenbeschaffung ...
   	// Variable fuer patTemplate-kompatible Datenhaltung ..
   	$xmlFileData=array();
	
	// da es pro id und Artikel mehrere versch. uniques gibt ($id+$language) muessen wir
	// hier Verrenkungen machen :-(
	$select="SELECT language from ".TABLE."_art_content WHERE ide='".$id."' group by language";
	$fQuery=mysql_query($select);
	while ($fResult = mysql_fetch_array($fQuery)){
		// Anlegen des Objektes per Referenz ( notify '&' header )
		// id wird aus $id+$language gebildet !!
		$xmlDocument = & new xmldocument($id."_".$fResult[0],$cbUserID,"","");
		// Liste der vorhandenen XML-Dateien des Artikels erzeugen ...
		if ($xmlDocument->listXmlFiles()){
			// Liste der Dateinamen abholen
			$xmlFiles=$xmlDocument->get_XmlFileList();
			// Daten dem patTemplate-Konstrukt $xmlFileData hinzufuegen ..
			foreach ($xmlFiles as $file){
				$xmlFileData["XMLFILENAME"][]=$file;
				$tmpArr=explode("_",$file);
				$time=explode("-",array_pop($tmpArr));
				//$time=substr($time,0,strpos( $time,"."));
				$day=explode("-",array_pop($tmpArr));
				$xmlFileData["XMLFILEDATE"][] =  sprintf("%02d.%02d.%04d, %02d:%02d:%02d",$day[2],$day[1],$day[0],$time[0],$time[1],$time[2]);
				$xmlFileData["XMLFILELENGTH"][] = filesize($file);
				$xmlFileData["IDE"][]=$id;
				$xmlFileData["LANGUAGEID"][]=$fResult[0];
				foreach ($artLangArr as $key => $value){
					if ($value==$fResult[0]){$xmlFileData["LANGUAGE"][]=$key;}
				}
			}
		}
	}
	// die Daten bei der Gelegenheit gleich dem patTemplate Objekt hinzufuegen ...
   	if (count($xmlFileData)) {
		$tpl->assign("listxmlfiles_row", $xmlFileData);  // ups, das sieht ja einfach aus ...
	}

	if(!count($xmlFileData)) {
		$errorList[] = $amError["no_user_article"];
		$tpl->assign("errorSet", "1");
		$tpl->assign("errorList", $errorList);
	}
	
	// Falls XML-Dateien zur Artikel-ID gefunden wurden

	$tpl->assign("listxmlfiles_general",
		array ( "title"       => $workingTitle,
				"id"          => $id
		)
	);
	
	$tpl->assign("listxmlfiles_set", "1");

	$mainPluginContent[]  = $tpl->fetch($config['templates']."listXmlFiles.template", null, "pluginArt2".$cbUserID);
	$mainMessageContent[] = $tpl->fetch($config['templates']."messages.template", null, "pluginArt2".$cbUserID);
?>
Return current item: Content*Builder