Location: PHPKode > projects > Content*Builder > contentbuilder/plugins/article2/commentManager.inc.php
<?php
	require_once($cbDirLib."CB_pageSplit.class.php");
	if(!(ADMIN & $cbPerms)) {
		if(!(MOD_OWN & $cbPerms) AND !(MOD_ALL & $cbPerms)) {
			echo $error_msg["permission-denied"];
			exit();
		}
	}
	
	if(!isset($articleID)) {
		$link1 = $PHP_SELF.'?load='.$config["urlIdent"].'&sub=commentManager';
	
		/* Offset für Page Navigation setzen */
		if (!$offset) { 
			$offset = 0; 
		}
		/* Limit setzen */
		$limit = 15;
	
		if((MOD_OWN & $cbPerms) || (MOD_ALL & $cbPerms) || (ADMIN & $cbPerms)) {
			$query_where = "";
			if(!(MOD_ALL & $cbPerms) && !(ADMIN & $cbPerms)) {
				$query_where = "WHERE userID = '$cbUserID'";
			}
			$queryt = mysql_query("SELECT * FROM ".TABLE."_art_general AS art LEFT JOIN ".TABLE."_user AS usr ON usr.userid = art.userID $query_where ORDER BY datetime DESC LIMIT $offset,$limit");
			
			if(mysql_num_rows($queryt) == 0) {
				$errorList[] = $amText["no_user_article"];
			} else {
				
				while($getquery = mysql_fetch_array($queryt)) {
					$tempTitle  = stripslashes($getquery["title"]);
					$firstsub   = substr($getquery["datetime"],0,10);
					$dt   = explode("-",$firstsub);
					$dat1 = $dt[2].".".$dt[1].".".$dt[0];
					$secondsub  = substr($getquery["datetime"],-8,5);
					$getquery["datetime"] = $dat1."&nbsp;".$secondsub;
	
					$getuserid = $getquery["userid"];
					
					$articleTitle[]  = $tempTitle;
					$articleIDE[]    = $getquery["ide"];
					$articleDate[]   = $getquery["datetime"];
					$articleAuthor[] = $getquery["fullname"].' ('.$getquery["initial"].')';
				}
				
				$result = mysql_fetch_assoc(mysql_query("SELECT COUNT(*) AS counter FROM ".TABLE."_art_general $query_where"));
				$articlePageNav = new CB_pageSplit($limit, $offset, $result[counter]);
				
				$tpl->assign("articleList",
					array ( "lastOffset"  => $articlePageNav->getLastOffset(),
							"nextOffset"  => $articlePageNav->getNextOffset(),
							"lastPageSet" => $articlePageNav->lastPageExists(),
							"nextPageSet" => $articlePageNav->nextPageExists(),
							"actualPage"  => $articlePageNav->getActualPage(),
							"pages"       => $articlePageNav->getPages()
					)
				);
	
				$tpl->assign("articleListRow",
					array ( "ID"     => $articleIDE,
							"TITLE"  => $articleTitle,
							"DATE"   => $articleDate,
							"AUTHOR" => $articleAuthor
					)
				);
	
				$tpl->assign("articleList_set", "1");
			}
		} else {
			$errorList[] = $amText["cant_modify"];
		}
	} else {
		/* Kommentare zu artikeln anzeigen */
		$articleQuery = mysql_query("SELECT * FROM ".TABLE."_art_general WHERE ide = '$articleID'");
		$articleData = mysql_fetch_assoc($articleQuery);
		
		if(mysql_num_rows($articleQuery) > 0) {
			if(isset($_REQUEST[deleteID])) {
				mysql_query("DELETE FROM ".TABLE."_comment WHERE commentID = '".$_REQUEST[deleteID]."'");
			}
			
			$commentArray = array();
			$articleCommentQuery = mysql_query("SELECT * FROM ".TABLE."_comment WHERE type = 'article2' AND entryID = '$articleID'");
			while($articleCommentRow = mysql_fetch_assoc($articleCommentQuery)) {
				$articleCommentRow[title] = stripslashes($articleCommentRow[title]);
				$articleCommentRow[text]  = stripslashes($articleCommentRow[text]);
				$commentArray[] = $articleCommentRow;
			} // while
		}
		
		if(count($commentArray) == 0) {
			$commentArray['empty'] = 1;
		}
		
		$tpl->assign("articleData", $articleData);
		$tpl->assign("commentData", $commentArray);
		$tpl->assign("show_comments_set", 1);
	}
	
	if(count($errorList) > 0) {
		$tpl->assign("errorSet", "1");
		$tpl->assign("errorList", $errorList);
	}
		
	$mainPluginContent[]  = $tpl->fetch($config['templates']."comments.template", null, "pluginArt2".$cbUserID);
	$mainMessageContent[] = $tpl->fetch($config['templates']."messages.template", null, "pluginArt2".$cbUserID);
?>
Return current item: Content*Builder