All pastes #943784 Raw Edit

Someone

public php v1 · immutable
·published 2008-03-15 16:20 UTC
rendered paste body
<?php /* 	NanoCMS v0.3 © 2007 Kalyan Chakravarthy ( www.KalyanChakravarthy.net )*/session_start();require_once "setting.php";runTweak('after-settings-load');//loginrunTweak( 'before-login-check' );if( !isset( $_SESSION[ NANO_CMS_ADMIN_LOGGED ] ) ) {	if( isset($_POST[user]) ) {		if( $_POST[user] == NANO_CMS_ADMIN_USER and $_POST[pass] == NANO_CMS_ADMIN_PASS ) {			$_SESSION[ LOGIN_TIME_STAMP ] = $ts = time();			$_SESSION[ NANO_CMS_ADMIN_LOGGED ] = md5(NANO_CMS_ADMIN_PASS.$ts); //die('done');			runTweak( 'after-logged-in' );		}	}}//logoutif( isset( $_GET[ logout ] ) )	{	echo('logged out<br />');	unset( $_SESSION[NANO_CMS_ADMIN_LOGGED] );}//the login formif( $_SESSION[NANO_CMS_ADMIN_LOGGED]!=md5(NANO_CMS_ADMIN_PASS.$_SESSION[ LOGIN_TIME_STAMP ]) or !isset( $_SESSION[NANO_CMS_ADMIN_LOGGED] ) ){	session_destroy();	runTweak( 'before-login-form' );	$form = "<html><head><title>NanoCMS Admin login</title></head><body style='font-family:courier'>";	$form.= "<form action='?' method='post'>username <input type=text name='user'><br />password <input type=password name='pass'><br />		     <input type='submit' value='Login'>";	runTweak( 'login-form', array( &$form ) );		echo $form;	exit();}function checkBoxList($checkList,$selected=array() ,$return=true) {	$op='';	foreach( $checkList as $key=>$ele ) {		$keyname = $key;//str_replace('-','_',$key);		$checked = ( in_array($key,$selected)?" checked=checked ":'' );		$val = "<span class='caps'>$key</span>";		$op.= "<input type='checkbox' id='check_$keyname' name='check_$keyname' value='$key' $checked><label for='check_$keyname'>$val</label>";		$op.= "&nbsp; &nbsp; &nbsp;";	}	if($return)	return $op;	else echo $op;}//performEdit()function performEdit() {	if( $_GET[action] != 'edit' ) return;	global $editErrMsg;		$slug = $_GET[slug];	$editErrMsg = array();	$catlist = getDetails('cats');		if( isset( $_POST[save] ) )	{		$newp = new Page();		$newp->loadSlug($slug);		$oldSlug = $slug;		$newSlug = slugify( $_POST[title] ); //newp->slug;		$fileName = pageDataDir($slug);		$newFileName = $newName = pageDataDir( $newSlug );		if( $slug=='' ) 			$editErrMsg[]= lt("Title cannot be empty");		$newp->catReset();		foreach( $catlist as $cat=>$cc ) {			if( isset( $_POST[ 'check_'.$cat ] ) )				$newp->addToCat( $cat );		}				if( count($newp->cats) == 0 )			$newp->addToCat('other-pages');		if( $newSlug!=$oldSlug ) // if a slug change has occured		{				$renameErr = false;			if( file_exists( $newName ) ) { 				$editErrMsg[] = lt("Cannot Rename Title: Another page with similar title already exists",'cannot-rename-title');				$renameErr = true;			}else			if( !rename($fileName,$newName) ) { 				$editErrMsg[]= lt("Error Renaming");				$renameErr = true;			}						if( !$renameErr ) //edit title only ifrename error has not occured				$newp->editTitle( stripslashes($_POST[title]) );						$fileName = $newName;		}				runTweak( 'file-contents-edit', array( &$_POST[content] ) );		if( !put2file( $fileName, stripslashes( $_POST[content] ) ) ) 			$editErrMsg[]=lt("Error writing to file",'file-write-error');	}		if( count($addtErrMsg)!=0 and isset($newp) ) { //error occured		$em = '';		foreach( $addtErrMsg as $msg ) $em .= "<li>$msg</li>";		MsgBox( lt('Errors Occured')." : <ul>$em</ul>", 'redbox' );	}	elseif( isset($newp) ) { //success : no error		$newp->commitChanges();		savepages();		$em = ''; $gmsg = array();		echo "<h2>".lt( 'Edit Content' )."</h2>";		$gmsg[] = lt("Content Edited Successfully",'content-edit-success-msg');		foreach( $gmsg as $msg ) $em .= "<li>$msg</li>";		MsgBox( "<ul>$em</ul>" );		return;	}	$ep = new Page();	$ep->loadSlug($slug);		$fileName = pageDataDir( $slug );	$formAction = "?action=edit&slug=$slug";	$fileContent = file_exists( $fileName )? htmlentities( file_get_contents( $fileName ) ) : lt("no content yet");	$submitButton = lt('Save Page Content');		$editLabel = lt( 'Edit Content' );	$catLabel = lt('Categories');	$contentLabel = lt('Content');		$title = $ep->title;	$chkboxs = checkBoxList( getDetails('cats'), $ep->cats );	runTweak( 'edit-form-display' );	$dlink1= '?action=delete&slug='.$_GET['slug'];	$deletejs = 'return confirm(\'Are your sure you want to deleate '.$_GET['slug'].'?\nYou cant undo this action!\');';	echo $te=<<<TET	<form action='$formAction' method=post class='pagemod_form'>		<h2>$editLabel : $ep->title</h2>		<table width='98%' border='0'>		  <tr>			<td width='20%'>Page Title</td>			<td><input type='text' value='$title' name='title'></td>		  </tr>		  <tr>			<td>$catLabel</td>			<td colspan=2>$chkboxs</td>		  </tr>		</table>		<h2>$contentLabel</h2>		<table width="98%">		  <tr><td colspan=2>							<textarea name='content' rows=20 cols=70 id='editbox' class='editbox'>$fileContent</textarea>		  </td></tr>		  <tr><td colspan=2><br /><input type='submit' value='$submitButton' name='save'> | <a href='$dlink1' onclick="$deletejs">Delete</a></td></tr>		</table>	</form>TET;	runTweak( 'after-edit-form-display' );}//doAreaEdit()function doAreaEdit() {	if( isset($_GET['do']) and $_GET['do']=='editarea' ) {		$areaCount = stripslashes($_POST[areaCount]);		$errCnt = 0;		for( $i=1; $i<=$areaCount; $i++ )		{			$areaNamei = stripslashes($_POST["areaName$i"]);			$areaContenti = stripslashes($_POST["areaContent$i"]);			$areaFilei = areaDataDir( "$areaNamei" );						if( !put2file( $areaFilei, $areaContenti ) ) {				$errCnt++;				$msg = sprintf( lt("Error saving area : <b>%s</b> to file <b>%s</b>",'error-saving-area-to-file'), $areaNamei, $areaFilei );				MsgBox( $msg );			}		}		if( $errCnt == 0 )			MsgBox( lt("All Area contents saved Successfully",'areas-save-success' ) );	}}//addpage()function addpage(){	$addtErrMsg = array();	$catlist = getDetails('cats');	$newp = new Page();	$newp->newPageInit();	$newp->addToCat( 'sidebar' );	if( isset( $_POST[save] ) )	{		$isFormSubmitted = true;		$content = stripslashes($_POST[content]);		$title = stripslashes($_POST[title]);		$newp->editTitle( $title );		$slug = $newp->slug;		$newp->catReset();		foreach( $catlist as $cat=>$cc ) {			if( isset( $_POST[ 'check_'.$cat ] ) )				$newp->addToCat( $cat );		}		if( count($newp->cats) == 0 )			$newp->addToCat('sidebar');		if( $title != '' and $content !='' )		{			$newPageFile = pageDataDir($slug);			if( !file_exists($newPageFile)  )			{				//view all cats						$newp->commitChanges();				//debug($newp);								runTweak( 'new-page', array( 'page-obj'=>&$newp, 'page-content'=> &$content ) );				if( put2file( $newPageFile, $content ) )					savepages();				$m = lt("The page was created successfully",'page-create-success'). '<br />';				$m .= lt("File Created") ." : ".$newPageFile."<br />";				$m .= lt("Content")." : ".substr( strip_tags($content), 0, 100 ).( strlen($content)>100 ? '...' : '' )."<br />";								MsgBox( $m );								return; // success			}			else			{				$addtErrMsg[] = lt("Save Failed");				if( file_exists($newPageFile) )					$addtErrMsg[] = lt("A page with similar Title already exists!!",'similar-page-title-exists');			}		}		else		$addtErrMsg[] = lt("Either the title or the content is/are empty!!! Please check your input!!<br />",'title-or-content-empty');		//die('fucked');		//savepages();	}	if( count($addtErrMsg)!=0 and isset($title) ) { //error occured		$em = '';		foreach( $addtErrMsg as $msg ) $em .= "<li>$msg</li>";		MsgBox( lt("Errors Occured")." : <ul>$em</ul>", 'background:#FFE8E8;border:1px solid #AE0000' );	}	//debug($addtErrMsg);	$formAction = "?action=addpage";	$submitButton = lt('Add Page');	$chkboxs = checkBoxList( getDetails('cats'), $newp->cats );		$pageTitleLabel = lt('Page Title');	$catsLabel = lt('Categories');	$contentLabel = lt('Content');	$addnewpageLabel = lt('Add new Page');		echo $te=<<<TET	<form action='$formAction' method=post class='pagemod_form'>		<h2>$addnewpageLabel</h2>		<table width='98%' border='0'>		  <tr>			<td width='20%'>$pageTitleLabel</td>			<td><input type='text' value='$title' name='title'></td>			<td align='right'><input type='submit' value='$submitButton' name='save'></td>		  </tr>		  <tr>			<td>$catsLabel</td>			<td colspan=2>$chkboxs</td>		  </tr>		</table>		<h2>$contentLabel</h2>		<table width="98%">		  <tr><td colspan=2>							<textarea name='content' rows=20 cols=70 id='editbox' class='editbox'>$content</textarea>		  </td></tr>		  <tr><td colspan=2><br /><input type='submit' value='$submitButton' name='save'></td></tr>		</table>	</form>TET;	runTweak( 'after-add-form-display' );}//performMove()function performMove() {	if( $_GET[action]=='reorder' ) {		$par = explode(',',$_GET[param]);		$par[0] = (int)$par[0];		$par[1] = (int)$par[1];		reorder( $_GET[cat], $par[0], $par[1] );		savepages();		$_SESSION[opencat]=$_GET[cat];		header( "Location:nanoadmin.php?action=pageorder" );	}}//New Function//pageOrder()function pageOrder(){				$cdt = getDetails('cats');				$slugs = getDetails('slugs');				$titles = getDetails('titles');	foreach($cdt as $catname=>$catslugs)	{		$slugids = array_values($catslugs);		$n = count($slugids)-1;		foreach($slugids as $pos=>$ids) {			$ul = makeLink("?action=reorder&cat=$catname&param=".$pos.','.($pos-1),'up');			$dl = makeLink("?action=reorder&cat=$catname&param=".$pos.','.($pos+1),'down');						if( $pos==0 ) $ul='up';			if( $pos==$n ) $dl='down';			echo "<b>".$titles[$ids]."</b>$ul | $dl<br />";			}	}}//reorder()function reorder($cat,$pos1,$pos2) {	$cats = getDetails('cats');	$cc = $cats[$cat][$pos1];	$cats[$cat][$pos1] = $cats[$cat][$pos2];	$cats[$cat][$pos2] = $cc;	setDetails('cats',$cats);}//savepages()function savepages() {	global $nc;	runTweak( 'on-save-pages' );	$pagesdata = serialize( $nc );	if( !put2file( PAGES_DETAILS_FILE, $pagesdata ) ) MsgBox( lt("file writing error"), 'redbox' );}//doDelete()function doDelete() {	$slug = $_GET[slug];	$slugList = getDetails('slugs');	$titleList = getDetails('titles');	$hp = getDetails('homepage');	$delpg = new Page();	$delpg->loadSlug($slug);		$title = $titleList[ $delpg->slugId ];		if( $delpg->slugId == $hp ) {		$msg = sprintf( lt("Cannot Delete <b>%s</b> : <b>Your homepage cannot be deleted</b>",'cannot-delete-homepage'),$title );		MsgBox( $msg, 'redbox' );		return;	}		runTweak( 'on-delete-page', array('page'=>$delpg) );	$delpg->catReset();	$delpg->commitChanges();		unset( $slugList[ $delpg->slugId ] );	unset( $titleList[ $delpg->slugId ] );		unlink( pageDataDir( $delpg->slug ) );		setDetails('slugs',$slugList);	setDetails('titles',$titleList);		savepages();		$msg = sprintf( "<strong>".lt("Page '%s' was Successfully Deleted",'page-delete-success').'</strong>',"<b>$title</b>" );		echo '<br />';		MsgBox( $msg, 'greenbox' );}//showareas()function showareas() {	doAreaEdit();	global $indexTemplateAreas;	demoExecuteNanoSite();	$sett = getDetails('settings');	$contents = $sett['def-template-areas'];		$areaInfo = array();	foreach( $contents as $areaName )	{		$areaFile = areaDataDir( "$areaName" );		$fileContent = file_exists($areaFile) ? file_get_contents( $areaFile ) : '';		$areaInfo[ $areaName ] = $fileContent;	}		$saveAllTxt = lt('Save all Areas');	$biggerInp = lt('Bigger Input Box');	$smallerInp = lt('Smaller Input Box');		echo "<form action='?action=showareas&do=editarea' method='post'>";	echo "<input type='submit' value='+ $saveAllTxt +' class='floatright'>";	echo "<input type='hidden' name='areaCount' value='".count($areaInfo)."'>";		$cnt = 1;	foreach( $areaInfo as $areaName=>$areaContents )	{		$boxId = "box$cnt";//md5($areaName);				echo "<h2>&raquo; $areaName</h2>			    <input type='hidden' name='areaName$cnt' value='$areaName'>				<table><tr valign='top'><td>				<textarea name='areaContent$cnt' rows='2' cols='60' id='$boxId' class='areabox'>".htmlentities( $areaContents )."</textarea>				</td><td>				<input type='button' onclick='makesmall(\"$boxId\")' value='-' title='$smallerInp' class='isizeh'>				<input type='button' onclick='makebig(\"$boxId\")' value='+' title='$biggerInp' class='isizeh'>				</td></tr></table>			 ";		$cnt++;	}	echo "<input type='submit' value='+ $saveAllTxt +' class='floatright'>";			echo "</form>";}function showTweaksInterface() {	global $tweakInterfaceList, $tweakList, $tweakData;	$tweakName = stripslashes($_GET[tweak]);	$tDet = $tweakData[ $tweakName ];	$name = $tDet['name'];	$ifunc = $tDet['interface'];	$author = $tDet['author'];		$authTxt = lt('Author');	$descTxt = lt('Description');	$optdatTxt = lt('Options and Data');	$optTxt = lt('Options');	$nameTxt = lt('Name');		echo "<h2>$name</h2>";	echo "$authTxt : $tDet[author]<br>";	echo "$descTxt : $tDet[desc]";		echo "<h2>$optdatTxt</h2>";	if( is_callable($ifunc) )		call_user_func( $ifunc );	}//showTweakers() - the tweakers interfacefunction showTweakers() {	global $tweakInterfaceList, $tweakList, $tweakData;	$activeTweaks = getDetails( 'active-tweaks' );		$descTxt = lt( 'Description' );	$optTxt = lt( 'Options' );		if( isset( $_GET['do'] ) ) {		$do = $_GET['do'];		$tweak = $_GET['tweak'];		if( $do == 'activate' && !in_array( $tweak, $activeTweaks ) ) {			$activeTweaks[] = $tweak;			echo MsgBox( lt( 'Tweak Activated' ) );		}		if( $do == 'deactivate' && in_array( $tweak, $activeTweaks ) ) {			$activeTweaks = array_diff( $activeTweaks, (array)$tweak );			echo MsgBox( lt( 'Tweak Deactivated' ) );		}		setDetails( 'active-tweaks', $activeTweaks );		savepages();	}	$tweakerDescTxt = lt("Tweakers are plugins like tools which can be used to tweak the NanoCMS<br/>",'tweakers-desc');		echo "<h2>Tweakers</h2>";	echo "<p>$tweakerDescTxt<br></p>";	echo "<h2>".lt('Active Tweakers')."</h2>";	$t = "<table border=1 cellpadding=5 width='95%' class='pageListTable'>";	$t.= "<tr class='th'><th>Tweaker $nameTxt</th><th>$descTxt</th><th>Tweaks</th><th>$optTxt</th><th>&nbsp;</th></tr>";		$viewInterfaceLable = lt('View Interface');	foreach( $tweakData as $tweakName=>$tweakInfo ) {		if( in_array( $tweakName , $activeTweaks ) )			$Lable = makeLink( "?action=tweakers&do=deactivate&tweak=$tweakName", lt('Deactivate') );		else			$Lable = makeLink( "?action=tweakers&do=activate&tweak=$tweakName",lt('Activate') );		$desc = $tweakData[ $tweakName ][ 'desc' ];		$opt = '';		$name = $tweakData[ $tweakName ][ 'name' ];		if( isset($tweakData[ $tweakName ]['interface']) ) {			$opt = makeLink( "?tweak=$tweakName", $viewInterfaceLable );		}		$twk = $tweakData[ $tweakName ][ 'tweaks' ];//		debug( $twk );		$tcnt = count( $twk );		$t.= "<tr><td><b>$name</b></td><td> $desc</td><td class='center'>$tcnt</td><td> $opt </td> <td>$Lable</td></tr>";	}		$t.= "</table>";		runTweak( 'before-tweakerlist-display', array( &$t ) );		echo $t;}//showpageslist()function showpageslist() {	global $nc;	demoExecuteNanoSite();	$cdt = getDetails('cats');	$sett = getDetails('settings');	$slugs = getDetails('slugs');	$titles = getDetails('titles');	$templateCats = $sett['def-template-links'];	$defaultCats = explode( ',', NANO_MUSTHAVE_CATS );	$musthaveCats = array_unique( array_merge( $templateCats, $defaultCats ) );		$selectedCat = 1;	$toggStat = 'false';	if( isset($_GET[addcat]) ) {		$newCatName = strtolower( stripslashes($_POST[catname]) );		if( in_array( $newCatName, array_keys($cdt) ) ) {			$msg = sprintf( lt( "Cannot add new Links Category : %s already exists",'cat-add-fail-already-exists'), "<b>$newCatName</b>" );			MsgBox( $msg );		}					else {			$cdt[$newCatName] = array();			$msg = sprintf( lt( "Pages Category %s Added Successfully",'cat-add-success'), "<b>$newCatName</b>" );			MsgBox( $msg,'greenbox' );			setDetails( 'cats', $cdt );			savepages();		}	}		if( isset($_GET[removecat]) ) {		$catN = $_GET[removecat];		if( !in_array($catN,array_keys($cdt) ) )			MsgBox( lt("Category to be deleted does not exist",'cat-to-del-not-exists'), 'redbox' );		else		if( in_array( $catN, $musthaveCats ) )			MsgBox( "<b>$catN</b> : ".lt('Cannot be deleted'), 'redbox' );		else {			unset( $cdt[ $catN ] );			$msg = sprintf( lt( "Pages Category %s was removed Successfully",'cat-remove-success'), "<b>$catN</b>" );			MsgBox( $msg,'greenbox' );			setDetails( 'cats', $cdt );			savepages();		}				}		$catSelectList = array();	foreach( $cdt as $cN=>$cSC ) $catSelectList[$cN] = $cN;		$pagesAndOpt = lt( 'Pages & Category Options','page-and-cat-opt' );	$pagesListing = lt( 'Pages & Category Listing','page-and-cat-list' );	$addNewCat = lt( 'Add new Category' );	$addToAnotherCat = lt( 'Add page to another category', 'add-page-to-another-cat' );	$addLabel = lt( 'Add' );		echo "<h2 id='cat_anchor'><span id='toggCon'></span>$pagesAndOpt</h2>			<table id='cat_options'>			 <tr>			 	<form action='?action=showpages&addcat=true' method='post'>				<td>$addNewCat : </td><td><input type='text' name='catname'> <input type='submit' value='$addLabel'></td>				</form>			 </tr>			</table>";			}// automatically gets the content_areas present in the template ////////////////////////////////$indexTemplateAreas = $indexTemplateLL = array();function readIntoAreaList($l,$a='',$b='') {	global $indexTemplateAreas;	$indexTemplateAreas[] = $l;}function readIntoLinksList($cat,$f='',$a='',$b='',$c='') {	global $indexTemplateLL;	$indexTemplateLL[] = $cat;}function demoExecuteNanoSite() {	global $indexTemplateAreas,$indexTemplateLL;		$sett = getDetails('settings');	$catt = getDetails('cats');	$indexLastModified = filemtime(NANO_CMS_PAGE);		if( $sett['index-last-modified'] >= $indexLastModified ) return;		$removeFunctionList = array('show_sidebar','show_content_slug','show_title','require_once');	$replaceFunction = 'dummyFunction';	$demoContentToRun = file_get_contents( NANO_CMS_PAGE );	$demoContentToRun = str_replace( 'show_content_area', 'readIntoAreaList', $demoContentToRun );	$demoContentToRun = str_replace( 'show_links', 'readIntoLinksList', $demoContentToRun );	$demoContentToRun = str_replace( $removeFunctionList, $replaceFunction, $demoContentToRun );		ob_start();	//eval(" > ".$demoContentToRun." ?php ");	$cont = ob_get_contents();	ob_end_clean();	MsgBox( lt("Template Changes Detected! Config & Settings updated!",'template-changes-detected') );	$newcatt = array_diff( $indexTemplateLL,array_keys($catt) );		foreach( $newcatt as $newcatname )		$catt[$newcatname] = array();			$sett['index-last-modified'] = $indexLastModified;	$sett['def-template-areas'] = array_unique( $indexTemplateAreas );	$sett['def-template-links'] = array_unique( $indexTemplateLL );	setDetails( 'settings', $sett );	setDetails( 'cats', $catt );	savepages();}performMove();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>Admin Area</title><link rel="stylesheet" type="text/css" charset="utf-8" href="stuff/css.css"/><!--[if lte IE 6]><link rel='stylesheet' href='stuff/css/ie.css' type='text/css' /><![endif]--><script type="text/javascript" src="http://nanocms.thelostworld.us/shared/scripts/mootools.js"></script><script type="text/javascript" src="stuff/ajax.js"></script><script type="text/javascript">window.addEvent('domready', function() {//pages	var managepages = new Fx.Slide('sub');	<?php		if($_GET['action'] == 'edit' || $_GET['action'] =='pageorder'){}		else{	?>	managepages.hide();	<?php }?>		$('showsub').addEvent('click', function(e){			e = new Event(e);			managepages.toggle();			e.stop();		});//advanced options	var showadv = new Fx.Slide('advsub');	showadv.hide();		$('showadv').addEvent('click', function(e){			e = new Event(e);			showadv.toggle();			e.stop();		});});</script><script type="text/javascript">	window.addEvent('domready', function() {		var vid = 0.3		cp('http://dev.thelostworld.us/nano/updater.php?vid='+vid,'log');		cp('http://dev.thelostworld.us/nano/news.php','ajaxnews');	});</script><?php runTweak( 'admin-head-content' ); ?></head><body onload=""><div id="menu"><div class="container"><h1 style="font-size:18px">NanoCMS Admin<br/>  <span class="smalli"><a href="nanoadmin.php">Home</a></span></h1><ul class="section">		<li><a href="?action=addpage" class="chr-gr">Create A Page</a></li>	</ul>	<ul class="section">		<li><a id="showsub" class="chr-r">-Manage Pages-</a>            <ul id="sub">            <?php				$cdt = getDetails('cats');				$slugs = getDetails('slugs');				$titles = getDetails('titles');				foreach($cdt as $catname=>$catslugs)				{					$slugids = array_values($catslugs);					$ucatname = ucfirst($catname);					echo '<br />';					echo $ucatname;					if( count($slugids) == 0 ) {						echo "<li style=\"color: red;\">No Pages Found :(</li>";						continue;					}					foreach($slugids as $pos=>$ids) {						$linkupper = ucfirst($titles[$ids]);						echo '<li>-<a href="?action=edit&slug='.$slugs[$ids].'">'.$linkupper.'</a></li>';						unset($linkupper);								}				}			?>            <li><a href="?action=pageorder">Change Page Order</a></li>            </ul>        </li>	</ul>	<ul class="section">    <li><a id="showadv">-Advanced Options-</a>   		<ul id="advsub">    		<li ><a href="?action=tweakers" class="chr-r">Tweakers</a></li>        </ul>    </li>	  	</ul>	<h1>Support</h1>	<ul class="section">    <li></li>		<li><a href="http://nanocms.kalyanchakravarthy.net/" class="chr-r">Help</a></li>		<li><a href="http://nanocms.kalyanchakravarthy.net/forums/" class="chr-gr">Contribute</a></li>	</ul><ul class="section"><li>Version:</li><li></li><!--<li style="text-decoration:blink;"><a href="#" class="chr-r">Update Needed</a></li>--><li id="log"></li></ul></div></div><div id="content"><div class="container"><?phpswitch($_GET['action']){case 'addpage'   : addpage();       break;case 'delete'    : doDelete();      break;case 'edit'      : performEdit();   break;case 'showpages' : showpageslist(); break;case 'editarea'  : doAreaEdit();    break;case 'showareas' : showareas();     break;case 'tweakers'  : showTweakers();  break;case 'pageorder' :	foreach($cdt as $catname=>$catslugs)	{		$slugids = array_values($catslugs);		$n = count($slugids)-1;		$ucatname = ucfirst($catname);		echo '<br />';		echo $ucatname;		echo '<br />';		if( count($slugids) == 0 ) {			echo "<li style=\"color: red;\">No Pages Found :(</li>\n";			continue;		}		echo "<table>\n";		foreach($slugids as $pos=>$ids) {			$ul = makeLink("?action=reorder&cat=$catname&param=".$pos.','.($pos-1),'up');			$dl = makeLink("?action=reorder&cat=$catname&param=".$pos.','.($pos+1),'down');						if( $pos==0 ) $ul='up';			if( $pos==$n ) $dl='down';			echo "<tr><td>".$titles[$ids]."</td><td>&nbsp;&nbsp;&nbsp;$ul&nbsp;|&nbsp;$dl</td></tr>\n";			}		echo "</table>\n";	}break;}if( isset($_GET[tweak]) ){showTweaksInterface();die ('</div></div></body></html>');}if(!$_GET['action']){?>	<h2 style="margin: 0pt 0pt 27px; font-size: 54px; line-height: 54px; letter-spacing: -0.02em; font-weight: normal; width: 700px;">Weclome [username], to your admin panel!.</h2><h2 style="margin: 0pt 0pt 33px; font-size: 24px; line-height: 27px; letter-spacing: -0.02em; font-weight: normal; width: 700px;">Explore, Add, and manage your site, all in one place!.<br />use the sidebar to the left to start updating!<br />  (&lt;-------)</h2><div><p>Server News</p><p style="margin-bottom: 3px;" id="ajaxnews"><a href="#">Loading the ajax...</a></p></div><?php}?></div></div></body></html>