Location: PHPKode > projects > Content*Builder > contentbuilder/plugins/article2/artModHead.inc.php
<?php
	// +----------------------------------------------------------------------+
	// | artModHead.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>                |
	// +----------------------------------------------------------------------+

	$link1 = $PHP_SELF.'?load='.$config["urlIdent"].'&sub=artModHead&'.SID;

	$tpl->assign("SUB", "artModHead&mod=1");
	
	if($articlePerms->hasEditPermission($id)) {
		/* 
		* Simple Checks whether User exists, ID's are properly set and so on
		*/
		if(!empty($id)) {
			$modQuery    = mysql_fetch_array(mysql_query("SELECT userID, rootID, options FROM ".TABLE."_art_general WHERE ide = '".$id."'"));
			$authorQuery = mysql_fetch_array(mysql_query("SELECT * FROM ".TABLE."_user WHERE userid = '$cbUserID'"));

			if(empty($modQuery)) {
				$cancel = true;
				$error[] = $amText['wrongID'];
			} else { 
				$tpl->assign("ID", $id);
				$tpl->assign("back_table_set", "1"); 
			}
			if($modQuery[options] == "") { $options = 0; } else { $options = $modQuery[options]; }
			$options &= ~ART_OPTION_PRINT; 
			if($print == 1) {
				$options |= ART_OPTION_PRINT;
			}
		} else {
			$error[] = $amText["no_id"];
			$cancel = true;
		}
		
		if(!$cancel AND $mod) {
			/* 
			* Zeitabhängiges Veröffentlichen 
			*/
			if($from != "von" && $to != "bis" && !empty($from) && !empty($to)) {
				$from = trim($from);
				$to = trim($to);
				if(isset($from) AND isset($to)) {
					if(ereg("^[0-9]{2}.[0-9]{2}.[0-9]{4}$",$from)) {
						if(isset($from)) {
							$from = explode(".",$from);
							$from = $from[2]."".$from[1]."".$from[0]."000000";
							$from = trim($from);
						}
					}
					if(ereg("^[0-9]{2}.[0-9]{2}.[0-9]{4}$",$to)) {
						if(isset($to)) {
							$to = explode(".",$to);
							$to = $to[2]."".$to[1]."".$to[0]."000000";
							$to = trim($to);
						}
					}
					
					/*
					* 
					else {
						$error[] = $error_msg['w_date_format'];
						$errorSet = 1;
						$cancel = true;
					}
					*/
				}
			}
			
			if($cbOption->getSingleOption("change_author")) {
				$newUsrID = ", userid = '$cbUserID'";
			} else {
				$newUsrID = "";
			}
			
			/* Vordefiniert: Artikel ist offline */
			if(!$stage) { 
				$stage = 4;
			}
			
			/* only rootarticles could be moved in other folders */
			if($modQuery[rootID] == $id) {
				mysql_query("UPDATE ".TABLE."_art_general SET folderID = '$folder' WHERE rootID = '$id'");
			}

			/* send update query */
			$update = mysql_query("UPDATE ".TABLE."_art_general SET title = '$title', publishFrom = '$from', publishTo = '$to', stage = '$stage', options = '$options', parse = '$format' $newUsrID WHERE ide = '$id'");
			
			/* Messages Output */
			if($update) {
				$message[] = $success_msg["settings_saved"];
			} else {
				$error[]   = "could not update";
			}
			
			cb_log(9);
		}
		
		if(!$mod) {
			if(!$cancel) {
				$modQuery = mysql_fetch_array(mysql_query("SELECT * FROM ".TABLE."_art_general WHERE ide = '$id'"));
				foreach($modQuery as $k => $value) {
					${$k} = $value;
				}
				
				if($rootID == $ide) {
					$articleType = "rootArticle";
					$artAdd_template = "add1Root";
				
					/* Collecting the Folder Tree Data */
					$folderTree = $nestedSet_folder->getAllNodes();
					if($folderTree != false) {
						foreach($folderTree as $v) {
							if($v[fid] == $folderID) {
								$folderListSelect[] = "checked";
							} else {
								$folderListSelect[] = "";
							}
							$folderListID[]    = $v[fid];
							$folderListName[]  = $v[fname];
							$folderListSpace[] = ($v[level] - 1) * 20;
						}
					}
									
					$tpl->assign($artAdd_template."FolderTreeRow",
						array ( "FNAME"		=> $folderListName,
								"ID"		=> $folderListID,
								"SPACE"		=> $folderListSpace,
								"SELECTED"	=> $folderListSelect
						)
					);
					$tpl->assign($artAdd_template."FolderTree_set", "1");
				} else {
					$articleType = "subArticle";
					$artAdd_template = "add1Sub";
				}
				
				## setting arrays for format HTML select template
				// Row1
					$format_value[]	 = 0;
					$format_text[]	= "HTML";
					$format_selected[] = "";
				// Row 2
					$format_value[]	 = 1;
					$format_text[]	= "Extended Text (TAG-System)";
					$format_selected[] = "";
				// Row 3
					$format_value[]	 = 2;
					$format_text[]	= "Text-Only";
					$format_selected[] = "";
				// Row 4
					$format_value[]	 = 3;
					$format_text[]   = "DHTML Editor";
					$format_selected[] = "";
					
				$format_selected[$modQuery['parse']] = "selected";
		
				if(ART_OPTION_PRINT & $options) { $chkPrint = "checked"; }
				$tpl->assign($artAdd_template."Form",
					array ( "VAL_PRINT"  => 1,
							"CHK_PRINT"  => $chkPrint,
							"ID"         => $id,
							"LANG"       => $lang_pf,
							"TITLE"      => $title,
							"ARTTYPE"    => $articleType,
							"PARENTID"   => $parentID
					)
				);
		
				$tpl->assign($artAdd_template."Format",
					array ( "VALUE"		=> $format_value,
							"SELECTED"	=> $format_selected,
							"TEXT"		=> $format_text
					)
				);
		
				if($cbOption->getSingleOption("timepost") == 1) {
					$datefrom = substr($publishFrom,6,2).'.'.substr($publishFrom,4,2).'.'.substr($publishFrom,0,4);
					$dateto	= substr($publishTo,6,2).'.'.substr($publishTo,4,2).'.'.substr($publishTo,0,4);
					$tpl->assign($artAdd_template."Timepost",
						array ( "VAL_FROM"	 => $datefrom,
								"VAL_TO"	 => $dateto
						)
					);
					$tpl->assign($artAdd_template."Timepost_set", "1");
				}
				
				if($cbOption->getSingleOption("artstatus") == 1) {
					for($z = 1; $z < 4; $z++) {
						if($stage == $z) {
							$stages[($z-1)] = 'selected';
						}
					}
					## setting arrays for icon HTML select template
					// Row1
					$stage_value[]	 = "1";
					$stage_text[]	= $amText["stage_development"];
					// Row 2
					$stage_value[]	 = "2";
					$stage_text[]	= $amText["stage_review"];
					// Row 3
					$stage_value[]	 = "3";
					$stage_text[]	= $amText["stage_published"];
					// Row 4
					$stage_value[]	 = "4";
					$stage_text[]	= $amText["stage_invisible"];
					
					$tpl->assign($artAdd_template."Stage_set", "1");
					$tpl->assign($artAdd_template."StageRow",
						array ( "VALUE"     => $stage_value,
								"SELECTED"  => $stages,
								"TEXT"      => $stage_text
						)
					);
				} else {
					$tpl->assign("STAGE", $stage);
				}
				$tpl->assign($artAdd_template."Form_set", "1");
			}
			
			if(count($message) > 0) {
				$tpl->assign("messageSet", "1");
				$tpl->assign("messageList", $message);
			}
			
			if(count($error) > 0) {
				$tpl->assign("errorSet", "1");
				$tpl->assign("errorList", $error);
			}
			
			$tpl->assign("articleType", $articleType);
			
			$mainPluginContent[]  = $tpl->fetch($config['templates']."add1.template", null, "pluginArt2".$cbUserID);
			$mainMessageContent[] = $tpl->fetch($config['templates']."messages.template", null, "pluginArt2".$cbUserID);
		} else {
			if(count($message) > 0) {
				$tpl->assign("messageSet", "1");
				$tpl->assign("messageList", $message);
			}
			include($pluginLocation."/artAdd3.inc.php");
		}	
	}
?>
Return current item: Content*Builder