Location: PHPKode > projects > Backend code/CMS for blizzle.com > v1.x/wizard.php
<?
// INCLUDES all neccessary page building functions
require "functions.php";


if (($function == "edit") || ($function == "append")) {

	$query = "SELECT * FROM item_headers WHERE itemID = $id;";
	$result = mysql_query ($query, $link) or die (mysql_error());
	list($itemID,$itemCategory,$itemSegment,$itemTitle,$itemDescription,$itemBody,$itemDate,$itemLinks,$displayname,$modpoints,$itemDescription_code,$itemBody_code) = mysql_fetch_row($result);

	if (((stripNonAN($displayname) == retUserName()) || (retUserFlag() == "@") || (retUserFlag() == "^")) || (((retUserFlag() == "%") || (retUserFlag() == "@") || (retUserFlag() == "^")) && ($function == "append"))) {
		if ($sub) {
			$query = "SELECT * FROM item_subs WHERE itemID = $itemID AND subID = $sub;";
			$result = mysql_query ($query, $link) or die (mysql_error());
			list($subID,$itemID,$subBody,$subLinks,$subBody_code) = mysql_fetch_row($result);
		}
	} else {
		exit('Death to you.');
	}

} 
if ($function == "addpage") {
	$query = "SELECT Count(*) FROM item_subs WHERE itemID = $itemID;";
	$result = mysql_query ($query, $link) or die (mysql_error());
	list($sub) = mysql_fetch_row($result);
	$sub++;
}


$item = array (

	0 => array (
		"title" => "Initial Post Information",
		"description" => "Please fill out these initial fields and click \"next\"",
		"fields" => array (
					0 => array (
							"name" => "title",
							"value" => "<input type=text name=title value=\"".htmlspecialchars($itemTitle)."\">",
						),
					1 => array (
							"name" => "category",
							"value" => categoryList($itemCategory),
						),
					2 => array (
							"name" => "sub-category",
							"value" => segmentList($itemSegment),
						),
					3 => array (
							"name" => " ",
							"value" => "<input type=hidden name=uid value=\"$itemID\">",
						),
					),
		),

	1 => array (
		"title" => "Initial Story (homepage)",
		"description" => "This information will show up on the front page. Please include a complete description of your post in this paragraph. If you do not plan to add a \"read more\" body to the post, include your complete post here.",
		"fields" => array (
					0 => array (
							"name" => "Story",
							"value" => "<textarea cols=35 rows=10 name=description>$itemDescription_code</textarea>",
						),
					),
		),
	2 => array (
		"title" => "Full Story Body",
		"description" => "This text will be displayed when somebody clicks \"read more\" to read the post. You do not need to repeat the initial paragraph here.   URLs in the Links box will show up under \"Related Links\".  If possible, use blizzle-code to add descriptions to the links.  One per line.",
		"fields" => array (
					0 => array (
							"name" => "Body",
							"value" => "<textarea cols=35 rows=10 name=body>$itemBody_code</textarea>",
						),
					1 => array (
							"name" => "Links",
							"value" => "<textarea cols=35 rows=3 name=links>".str_replace(";","\n",$itemLinks)."</textarea>",
						),
					),
		),
	3 => array (
		"title" => "Finishing Up",
		"description" => "You are now just about done. If you plan to add additional pages to this story, please check the box below. When you are complete you may click \"finish\" to submit your post.",
		"fields" => array (
					0 => array (
							"name" => "Add another page?",
							"value" => "<input type=checkbox name=another value=true> Yes",
						),
					),
		),
);


$append = array (

	0 => array (
		"title" => "Append to story",
		"description" => "You can append information or corrections to this story.  Your changes will appear at the end of the existing story.",
		"fields" => array (
					0 => array (
							"name" => "Story",
							"value" => "(you can not change this - for reference only)<textarea cols=35 readonly rows=2>$itemDescription_code</textarea><br>[hr][b]updated by ".retUserNameFormatted(null,null)."[/b][p]<textarea cols=35 rows=10 name=description></textarea>",
						),
					1 => array (
							"name" => "Body",
							"value" => "(you can not change this - for reference only)<textarea cols=35 readonly rows=2>$itemBody_code</textarea><br>[hr][b]updated by ".retUserNameFormatted(null,null)."[/b][p]<textarea cols=35 rows=10 name=body></textarea>",
						),
					2 => array (
							"name" => " ",
							"value" => "<input type=hidden name=uid value=\"$itemID\">",
						),
					),
		),
);


$review = array (

	0 => array (
		"title" => "Initial Post Information",
		"description" => "Please fill out these initial fields and click \"next\"",
		"fields" => array (
					0 => array (
							"name" => "title",
							"value" => "<input type=text>",
						),
					1 => array (
							"name" => "category",
							"value" => "<input type=text>",
						),
					2 => array (
							"name" => "sub-category",
							"value" => "<input type=text>",
						),
					),
		),

	1 => array (
		"title" => "Initial Story (homepage)",
		"description" => "This information will show up on the front page. Please include a complete description of your post in this paragraph. If you do not plan to add a \"read more\" body to the post, include your complete post here.",
		"fields" => array (
					0 => array (
							"name" => "Story",
							"value" => "<textarea cols=35 rows=10></textarea>",
						),
					),
		),
	2 => array (
		"title" => "Full Story Body",
		"description" => "This text will be displayed when somebody clicks \"read more\" to read the post. You do not need to repeat the initial paragraph here",
		"fields" => array (
					0 => array (
							"name" => "Body",
							"value" => "<textarea cols=35 rows=10></textarea>",
						),
					),
		),
	3 => array (
		"title" => "Finishing Up",
		"description" => "You are now just about done. If you plan to add additional pages to this story, please check the box below. When you are complete you may click \"finish\" to submit your post.",
		"fields" => array (
					0 => array (
							"name" => "Add another page?",
							"value" => "<input type=checkbox> Yes",
						),
					),
		),
);


$release = array (

	0 => array (
		"title" => "Choose Application",
		"description" => "Please choose your application description from the list, or enter a new description.",
		"fields" => array (
					0 => array (
							"name" => "name",
							"value" => descList(null),
						),
					1 => array (
							"name" => " ",
							"value" => " ",
						),
					2 => array (
							"name" => "new release name:",
							"value" => "<input type=text name=newdescription>",
						),
					3 => array (
							"name" => "new description:",
							"value" => "<textarea cols=35 rows=10 name=newdescriptionbody></textarea>",
						),
					),
		),

	1 => array (
		"title" => "Additional Information",
		"description" => "Please enter the following additional information about this release.  Download Link and Category are required.",
		"fields" => array (
					0 => array (
							"name" => "version",
							"value" => "<input type=text name=relversion>",
						),
					1 => array (
							"name" => "category",
							"value" => categoryList("shell"),
						),
					2 => array (
							"name" => "download link",
							"value" => "<input type=text name=rellink>",
						),
					3 => array (
							"name" => "reported by",
							"value" => "<input type=text name=reportedby>",
						),
					),
		),
	2 => array (
		"title" => "Release comment and changes",
		"description" => "Include your personal comments on this release in the comment field.  These will be displayed on the home page.  Please enter the changes/new features of this release in the changes field.",
		"fields" => array (
					0 => array (
							"name" => "Comment",
							"value" => "<textarea cols=35 rows=5 name=comment></textarea>",
						),
					1 => array (
							"name" => "Changes",
							"value" => "<textarea cols=35 rows=10 name=changes></textarea>",
						),
					),
		),
	3 => array (
		"title" => "Finishing Up",
		"description" => "You are now just about done. If you would not like this release to show on the home page, please un-check the box below. When you are complete you may click \"finish\" to submit your post.",
		"fields" => array (
					0 => array (
							"name" => "Show on home page?",
							"value" => "<input type=checkbox checked name=onhomepage value=true> Yes",
						),
					),
		),
);


$quickie = array (

	0 => array (
		"title" => "Initial Post Information",
		"description" => "Please fill out these initial fields and click \"next\"",
		"fields" => array (
					0 => array (
							"name" => "title",
							"value" => "<input type=text name=title>",
						),
					1 => array (
							"name" => "category",
							"value" => categoryList(null),
						),
					2 => array (
							"name" => "sub-category",
							"value" => segmentList(null),
						),
					),
		),

	1 => array (
		"title" => "Story (homepage)",
		"description" => "This information will show up on the front page. Since this is a \"quickie\" include your whole post here.  Click on \"finish\" when you're done.",
		"fields" => array (
					0 => array (
							"name" => "Story",
							"value" => "<textarea cols=35 rows=10 name=description></textarea>",
						),
					),
		),
);



$addpage = array (

	0 => array (
		"title" => "Add page to post.",
		"description" => "Please fill out these initial fields and click \"next\"",
		"fields" => array (
					0 => array (
							"name" => "Item ID",
							"value" => "$itemID<input type=hidden name=itemID value=\"$itemID\">",
						),
					1 => array (
							"name" => "Page ID",
							"value" => "$sub<input type=hidden name=pageID value=\"$sub\">",
						),
					2 => array (
							"name" => "Page Text",
							"value" => "<textarea cols=35 rows=10 name=body>$subBody_code</textarea>",
						),
					3 => array (
							"name" => "Links",
							"value" => "<textarea cols=35 rows=3 name=links>".str_replace(";","\n",$subLinks)."</textarea>",
						),
					4 => array (
							"name" => "Add another page?",
							"value" => "<input type=checkbox name=another value=true> Yes",
						),
					5 => array (
							"name" => " ",
							"value" => "<input type=hidden name=aedit value=\"".(strlen(trim($subBody_code)) ? "true" : "false")."\">",
						),
					),
		),

);


$article = array (

	0 => array (
		"title" => "Initial Post Information",
		"description" => "Please fill out these initial fields and click \"next\"",
		"fields" => array (
					0 => array (
							"name" => "title",
							"value" => "<input type=text>",
						),
					1 => array (
							"name" => "category",
							"value" => "<input type=text>",
						),
					2 => array (
							"name" => "sub-category",
							"value" => "<input type=text>",
						),
					),
		),

	1 => array (
		"title" => "Initial Story (homepage)",
		"description" => "This information will show up on the front page. Please include a complete description of your post in this paragraph. If you do not plan to add a \"read more\" body to the post, include your complete post here.",
		"fields" => array (
					0 => array (
							"name" => "Story",
							"value" => "<textarea cols=35 rows=10></textarea>",
						),
					),
		),
	2 => array (
		"title" => "Full Story Body",
		"description" => "This text will be displayed when somebody clicks \"read more\" to read the post. You do not need to repeat the initial paragraph here",
		"fields" => array (
					0 => array (
							"name" => "Body",
							"value" => "<textarea cols=35 rows=10></textarea>",
						),
					),
		),
	3 => array (
		"title" => "Finishing Up",
		"description" => "You are now just about done. If you plan to add additional pages to this story, please check the box below. When you are complete you may click \"finish\" to submit your post.",
		"fields" => array (
					0 => array (
							"name" => "Add another page?",
							"value" => "<input type=checkbox> Yes",
						),
					),
		),
);






if (!retLoggedIn()) {
$retval = createItem("Post New Item Wizard",date("Y-m-d H:i:s"),"BOOKMARKS ARE A TOOL OF SANTA!  Please login before you come here.",null,"blizzle","admin","blizzle",null,null,null,null,null);
} else {

switch ($function) {
	case 'item':
		$retval = createItem("Post New Item Wizard",date("Y-m-d H:i:s"),"Please use the form below to create your post.  Click \"next\" to continue on to the next part, and \"finish\" to submit your post<p>".createWizard($item,"item"),null,"blizzle","admin","blizzle",null,null,null,null,null);
		break;
	case 'review':
		$retval = createItem("Post New Item Wizard",date("Y-m-d H:i:s"),"Please use the form below to create your post.  Click \"next\" to continue on to the next part, and \"finish\" to submit your post<p>".createWizard($review,"review"),null,"blizzle","admin","blizzle",null,null,null,null,null);
		break;
	case 'release':
		$retval = createItem("Post New Item Wizard",date("Y-m-d H:i:s"),"Please use the form below to create your post.  Click \"next\" to continue on to the next part, and \"finish\" to submit your post<p>".createWizard($release,"release"),null,"blizzle","admin","blizzle",null,null,null,null,null);
		break;
	case 'quickie':
		$retval = createItem("Post New Item Wizard",date("Y-m-d H:i:s"),"Please use the form below to create your post.  Click \"next\" to continue on to the next part, and \"finish\" to submit your post<p>".createWizard($quickie,"quickie"),null,"blizzle","admin","blizzle",null,null,null,null,null);
		break;
	case 'article':
		$retval = createItem("Post New Item Wizard",date("Y-m-d H:i:s"),"Please use the form below to create your post.  Click \"next\" to continue on to the next part, and \"finish\" to submit your post<p>".createWizard($article,"article"),null,"blizzle","admin","blizzle",null,null,null,null,null);
		break;
	case 'addpage':
		$retval = createItem("Post New Item Wizard",date("Y-m-d H:i:s"),"Please use the form to add a page to your post.  Click on \"finish\" to submit your page<p>".createWizard($addpage,"addpage"),null,"blizzle","admin","blizzle",null,null,null,null,null);
		break;
	case 'success':
		$retval = createItem("Post New Item Wizard",date("Y-m-d H:i:s"),"<font color=blue>Your post/update was completed successfully.  Let's do it again baby.</font><p>Welcome to blizzle's posting wizards.  Please select your wizard from the list below.<ul><li><a href=\"wizard.php?function=item\">General Post</a><li>Review<li><a href=\"wizard.php?function=release\">Release</a><li><a href=\"wizard.php?function=quickie\">Quickie</a><li>Article</ul>",null,"blizzle","admin","blizzle",null,null,null,null,null);
		break;
	case 'failure':
		$retval = createItem("Post New Item Wizard",date("Y-m-d H:i:s"),"<font color=red>ACK!  ERROR, ERROR, ERROR! Something went wrong.  Oops.  Is the site still live?</font><p>Welcome to blizzle's posting wizards.  Please select your wizard from the list below.<ul><li><a href=\"wizard.php?function=item\">General Post</a><li>Review<li><a href=\"wizard.php?function=release\">Release</a><li><a href=\"wizard.php?function=quickie\">Quickie</a><li>Article</ul>",null,"blizzle","admin","blizzle",null,null,null,null,null);
		break;
	case 'edit':
		if ($sub) {
			$retval = createItem("Post New Item Wizard",date("Y-m-d H:i:s"),"Please use the form to edit this page of your post.  Click on \"finish\" to submit your page<p>".createWizard($addpage,"addpage"),null,"blizzle","admin","blizzle",null,null,null,null,null);
		} else {
			$retval = createItem("Post New Item Wizard",date("Y-m-d H:i:s"),"Please use the form below to edit this post.  Click \"next\" to continue on to the next part, and \"finish\" to submit your post<p>".createWizard($item,"edit"),null,"blizzle","admin","blizzle",null,null,null,null,null);
		}
		break;
	case 'append':
		$retval = createItem("Post New Item Wizard",date("Y-m-d H:i:s"),"Please use the form below to update this post.  Click \"finish\" to submit your post<p>".createWizard($append,"append"),null,"blizzle","admin","blizzle",null,null,null,null,null);
		break;
	default:
		$retval = createItem("Post New Item Wizard",date("Y-m-d H:i:s"),"Welcome to blizzle's posting wizards.  Please select your wizard from the list below.  If you need help with blizcode, blizzle's markup language for posts, <a href=\"/index.php?uid=143\">click here</a>.<ul><li><a href=\"wizard.php?function=item\">General Post</a><li>Review<li><a href=\"wizard.php?function=release\">Release</a><li><a href=\"wizard.php?function=quickie\">Quickie</a><li>Article</ul>",null,"blizzle","admin","blizzle",null,null,null,null,null);
		break;
}


}
global $excludeHeftyReplace;
$excludeHeftyReplace = true;
createPage($retval);
$excludeHeftyReplace = false;
?>
Return current item: Backend code/CMS for blizzle.com