Location: PHPKode > projects > SiteX > admin/home_manager.php
<?PHP
ob_start();
session_start();
include("../includes/globals.php.inc");
include("../includes/functions.php");
include("../lang/English.php");
if(strtolower($sxSetup['Language']) != 'english') include("../lang/".$sxSetup['Language'].".php");
include("../themes/$THEME_FOLDER/config.php.inc");
if((!userEditor())AND(!userAdmin()))  loginError($sxLang['LoginRequired']);
if((userEditor())AND(!$sxSetup['EditorRightsHomepageOptions']))  loginError($sxLang['LoginRequired']);

if($Submit)
{
	$query = "UPDATE $DB_Setup SET setup_value='$edit_site_name' WHERE setup_key='SiteName'";
	$result = mysql_query($query, $Link) or queryError("55", mysql_error());

	$query = "UPDATE $DB_Setup SET setup_value='$edit_text_welcome' WHERE setup_key='TextWelcome'";
	$result = mysql_query($query, $Link) or queryError("55", mysql_error());
	
	$query = "UPDATE $DB_Setup SET setup_value='$edit_text_header' WHERE setup_key='TextHeader'";
	$result = mysql_query($query, $Link) or queryError("55", mysql_error());
	
	if($edit_show_search != 1) $edit_show_search = 0;
	$query = "UPDATE $DB_Setup SET setup_value='$edit_show_search' WHERE setup_key='ShowSearch'";
	$result = mysql_query($query, $Link) or queryError("55", mysql_error());
	
	if($edit_show_login != 1) $edit_show_login = 0;
	$query = "UPDATE $DB_Setup SET setup_value='$edit_show_login' WHERE setup_key='ShowLogin'";
	$result = mysql_query($query, $Link) or queryError("55", mysql_error());

	if($edit_homepage_show_photos != 1) $edit_homepage_show_photos = 0;
	$query = "UPDATE $DB_Setup SET setup_value='$edit_homepage_show_photos' WHERE setup_key='HomepageRandomPhotos'";
	$result = mysql_query($query, $Link) or queryError("5022", mysql_error());

	if($edit_homepage_show_recentcomments != 1) $edit_homepage_show_recentcomments = 0;
	$query = "UPDATE $DB_Setup SET setup_value='$edit_homepage_show_recentcomments' WHERE setup_key='HomepageRecentComments'";
	$result = mysql_query($query, $Link) or queryError("5022", mysql_error());

	if($edit_homepage_show_recenttopics != 1) $edit_homepage_show_recenttopics = 0;
	$query = "UPDATE $DB_Setup SET setup_value='$edit_homepage_show_recenttopics' WHERE setup_key='HomepageRecentTopics'";
	$result = mysql_query($query, $Link) or queryError("5022", mysql_error());

	if($edit_homepage_show_upcomingevents != 1) $edit_homepage_show_upcomingevents = 0;
	$query = "UPDATE $DB_Setup SET setup_value='$edit_homepage_show_upcomingevents' WHERE setup_key='HomepageUpcomingEvents'";
	$result = mysql_query($query, $Link) or queryError("5022", mysql_error());

	if($edit_homepage_show_currentpoll != 1) $edit_homepage_show_currentpoll = 0;
	$query = "UPDATE $DB_Setup SET setup_value='$edit_homepage_show_currentpoll' WHERE setup_key='HomepageCurrentPoll'";
	$result = mysql_query($query, $Link) or queryError("5022", mysql_error());

	if($edit_homepage_show_minicalendar != 1) $edit_homepage_show_minicalendar = 0;
	$query = "UPDATE $DB_Setup SET setup_value='$edit_homepage_show_minicalendar' WHERE setup_key='HomepageMiniCalendar'";
	$result = mysql_query($query, $Link) or queryError("5022", mysql_error());

	
	writeRSSXML();
	
	header("Location:$PHP_SELF?message=".$sxLang['HomeManagerUpdated']);
	die();
}

$sxTitleAddendum = $sxLang['AdminHeading'] . ' - ' .$sxLang['HomeManagerHeading'];
include("../themes/$THEME_FOLDER/header.php");
?>

<?PHP
// ============================== TinyMCE ==============================
if($sxSetup['WYSIWYG'] == 'tinymce') { ?>
<script type="text/javascript" src="../includes/tinymce/tiny_mce.js"></script>
<script type="text/javascript">
<!--
	tinyMCE.init({
		// General options
		mode : "textareas",
		editor_selector : 'mceEditor',
		language : "<?PHP echo $sxSetupTinyMCELanguage; ?>",
		theme : "advanced",
		relative_urls : false,
		plugins : "safari,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,preview,media,searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",

		// Theme options
		theme_advanced_buttons1 : "fullscreen,|,undo,redo,|,bold,italic,underline,strikethrough,|,forecolor,backcolor,|,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,justifyleft,justifycenter,justifyright,justifyfull,|,outdent,indent,blockquote,|,link,unlink,anchor,image,cleanup,help,code",
		theme_advanced_buttons3 : "tablecontrols,|,removeformat,visualaid,visualchars,|,sub,sup,|,charmap,iespell,media,advhr",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Example content CSS (should be your site CSS)
		//content_css : "css/content.css",

		// Drop lists for link/image/media/template dialogs
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		// Replace values for the template plugin
		template_replace_values : {
			username : "",
			staffid : ""
		}
	});

function fileInsertTinyMCE(selObj)
{
	var fileid = selObj.options[selObj.selectedIndex].value;
	var filename = new Array();
	<?PHP
	$query2 = "SELECT * FROM $DB_Files";
	$result2 = mysql_query($query2, $Link);
	while($ROW2 = mysql_fetch_object($result2))	
		echo "	filename[$ROW2->id] = '" . addslashes($ROW2->name) . "';\n";
	?>
	
	if(fileid)
	{
			tinyMCE.execCommand('mceInsertContent',false,'<a href="<?PHP echo sxPathToRoot()."/"; ?>redirect.php?fileid='+fileid+'">'+filename[fileid]+'</a>');
	}
}
	
function pageInsertTinyMCE(selObj)
{
	var pageid = selObj.options[selObj.selectedIndex].value;
	var pagename = new Array();
	<?PHP
	$query2 = "SELECT * FROM $DB_Pages";
	$result2 = mysql_query($query2, $Link);
	while($ROW2 = mysql_fetch_object($result2))	
		echo "	pagename[$ROW2->id] = '" . addslashes($ROW2->name) . "';\n";
	?>
		
	if(pageid)
	{
		tinyMCE.execCommand('mceInsertContent',false,'<a href="<?PHP echo sxPathToRoot()."/"; ?>page.php?pageid='+pageid+'">'+pagename[pageid]+'</a>');
	}
}

//-->
</script>

<?PHP
} // end if(tinymce)

// ============================== F C K ==============================
if($sxSetup['WYSIWYG'] == 'fck') {
	include("../includes/fck/fckeditor.php");
?>
<script language="JavaScript" type="text/JavaScript">
<!--
function fileInsertFCK(selObj)
{
	var fileid = selObj.options[selObj.selectedIndex].value;
	var filename = new Array();
	<?PHP
	$query2 = "SELECT * FROM $DB_Files";
	$result2 = mysql_query($query2, $Link);
	while($ROW2 = mysql_fetch_object($result2))	
		echo "	filename[$ROW2->id] = '" . addslashes($ROW2->name) . "';\n";
	?>
	
	if((fileid)&&(fileid != 0))
	{
		var oEditor = FCKeditorAPI.GetInstance('content') ;
		oEditor.SetData( oEditor.GetData() +  '<A HREF="redirect.php?fileid='+fileid+'">'+filename[fileid]+'</A>') ;
	}
}

function pageInsertFCK(selObj)
{
	var pageid = selObj.options[selObj.selectedIndex].value;
	var pagename = new Array();
	<?PHP
	$query2 = "SELECT * FROM $DB_Pages";
	$result2 = mysql_query($query2, $Link);
	while($ROW2 = mysql_fetch_object($result2))	
		echo "	pagename[$ROW2->id] = '" . addslashes($ROW2->name) . "';\n";
	?>
		
	if((pageid)&&(pageid != 0))
	{
		var oEditor = FCKeditorAPI.GetInstance('content') ;
		oEditor.SetData( oEditor.GetData() +  '<A HREF="page.php?pageid='+pageid+'">'+pagename[pageid]+'</A>') ;
	}
}
-->
</script>
<?PHP
} // end if(FCK)

// ============================== htmlarea ==============================
if($sxSetup['WYSIWYG'] == 'htmlarea') {
?>
<script language="JavaScript" type="text/JavaScript">
<!--
_editor_url = "../includes/htmlarea/";                     // URL to htmlarea files
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) {
  document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
  document.write(' language="Javascript1.2"></scr' + 'ipt>'); 
} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }

function fileInsertHA(selObj)
{
	var fileid = selObj.options[selObj.selectedIndex].value;
	var filename = new Array();
	<?PHP
	$query2 = "SELECT * FROM $DB_Files";
	$result2 = mysql_query($query2, $Link);
	while($ROW2 = mysql_fetch_object($result2))	
		echo "	filename[$ROW2->id] = '" . addslashes($ROW2->name) . "';\n";
	?>
	
	if(fileid)
	{
		if (win_ie_ver >= 5.5)
		{
			editor_insertHTML('content', '<A HREF="redirect.php?fileid='+fileid+'">'+filename[fileid]+'</A>', '', 0);
		}
		else{
			var content = window.document.sxForm1.content.value; 
			window.document.sxForm1.content.value = content + '---FILE'+fileid+'---'; 
			window.document.sxForm1.content.focus();
		}
	}
}

function pageInsertHA(selObj)
{
	var pageid = selObj.options[selObj.selectedIndex].value;
	var pagename = new Array();
	<?PHP
	$query2 = "SELECT * FROM $DB_Pages";
	$result2 = mysql_query($query2, $Link);
	while($ROW2 = mysql_fetch_object($result2))	
		echo "	pagename[$ROW2->id] = '" . addslashes($ROW2->name) . "';\n";
	?>
		
	if(pageid)
	{
		if (win_ie_ver >= 5.5)
		{
			editor_insertHTML('content', '<A HREF="page.php?pageid='+pageid+'">'+pagename[pageid]+'</A>', '', 0);
		}
		else
		{
			var content = window.document.sxForm1.content.value; 
			window.document.sxForm1.content.value = content + '---PAGE'+pageid+'---'; 
			window.document.sxForm1.content.focus();
		}
	}
}
//-->
</script> 
<?PHP } // end if(htmlarea) ?>

<div class="bodyWrapper">
   <h1 class="sxAdminHeading"><?PHP echo $sxLang['HomeManagerHeading']; ?></h1>
   <div class="sxAdminBreadcrumbs"><?PHP if(userAdmin()) { ?><a href="index.php"><?PHP echo $sxLang['AdminBreadcrumb']; ?><?PHP }?><?PHP if(userEditor()) { ?><a href="editor_index.php"><?PHP echo $sxLang['EditorBreadcrumb']; ?><?PHP }?></a> > <?PHP echo $sxLang['HomeManagerHeading']; ?></div>   
   <?PHP echoMessage($message); ?>
<form name="sxForm1" method="post" action="<?PHP echo $PHP_SELF; ?>" onSubmit="return submitIt(this)">
<table border="0" cellspacing="2" cellpadding="5">
		<tr> 
		  <td class="sxTdItem"><?PHP echo $sxLang['PreferencesItemSiteName']; ?></td>
		  <td><input type="text" name="edit_site_name" value="<?PHP echo  htmlspecialchars($sxSetup['SiteName']); ?>" style="width:300px;" />
			  </td>
		</tr>
		<tr> 
		  <td class="sxTdItem"><?PHP echo $sxLang['PreferencesItemWelcome']; ?><br />
		  </td>
		  <td>
		<div style="text-align:center;background:#EFEFDE;padding:5px;width:440px;color:#000000;">
		<strong><?PHP echo $sxLang['Autolink']; ?></strong>&nbsp;&nbsp;
		<select name="insert_file" style="width:158px;" onChange="fileInsert<?PHP
			switch($sxSetup['WYSIWYG'])
			{
				case 'fck' :
					echo 'FCK';
					break;
				case 'htmlarea' :
					echo 'HA';
					break;
				case 'tinymce' :
					echo 'TinyMCE';
					break;
			}
		?>(this)">
		<option value="0"><?PHP echo $sxLang['LinkFile']; ?></option>
		<?PHP
		$queryF = "SELECT * FROM $DB_Files ORDER BY filename";
		$resultF = mysql_query($queryF, $Link);
		while($ROWF = mysql_fetch_object($resultF)){
			echo '<option value="' . $ROWF->id . '">[' . $ROWF->id . '] ' . $ROWF->name . '</option>'."\n";
		}
		?>
		</select>&nbsp;&nbsp;
		<select name="insert_page" style="width:158px;" onChange="pageInsert<?PHP
			switch($sxSetup['WYSIWYG'])
			{
				case 'fck' :
					echo 'FCK';
					break;
				case 'htmlarea' :
					echo 'HA';
					break;
				case 'tinymce' :
					echo 'TinyMCE';
					break;
			}
		?>(this)">
		<option value="0"><?PHP echo $sxLang['LinkPage']; ?></option>
		<?PHP
		$queryP = "SELECT * FROM $DB_Pages ORDER BY name";
		$resultP = mysql_query($queryP, $Link);
		while($ROWP = mysql_fetch_object($resultP)){
			echo '<option value="' . $ROWP->id . '">[' . $ROWP->id . '] ' . $ROWP->name . '</option>'."\n";
		}
		?>
		</select></div>
		<?PHP
    	
		// Run TinyMCE
		if($sxSetup['WYSIWYG'] == 'tinymce')
			echo '<textarea id="edit_text_welcome" class="mceEditor" name="edit_text_welcome" rows="25" cols="80" style="width: 80%">'.$sxSetup['TextWelcome'].'</textarea>';
			
		// Run FCKeditor
		if($sxSetup['WYSIWYG'] == 'fck')
		{
		$oFCKeditor = new FCKeditor('edit_text_welcome') ;
		
		$oFCKeditor->Config['DefaultLanguage'] = $sxSetupFCKLanguage ;
		$oFCKeditor->BasePath = getURLFolder() . '/includes/fck/' ;
		$sxFCKServerPath = getURLFolder() . '/content/fck/';
		
		$sxFCKConnectorPath = $oFCKeditor->BasePath . 'editor/filemanager/browser/default/browser.html?Connector=../../connectors/php/connector.php?ServerPath=' . $sxFCKServerPath;
					
		$oFCKeditor->Config['LinkBrowserURL']  = $sxFCKConnectorPath;
		$oFCKeditor->Config['ImageBrowserURL'] = $sxFCKConnectorPath . '&Type=Image';
		$oFCKeditor->Config['FlashBrowserURL'] = $sxFCKConnectorPath . '&Type=Flash';
		
		$oFCKeditor->Width  = '450' ;
		$oFCKeditor->Height = '400' ;
		
		$oFCKeditor->Value = $sxSetup['TextWelcome'];
		$oFCKeditor->Create() ;
		}
		
		if($sxSetup['WYSIWYG'] == 'htmlarea') {
		?>
		<textarea name="edit_text_welcome" id="edit_text_welcome" style="width:575px;height:500px;"><?PHP echo $sxSetup['TextWelcome']; ?></textarea>
		  <script language="javascript1.2">
			var config = new Object();    // create new config object
			
			config.width = "450px";
			config.height = "400px";
			config.bodyStyle = 'background-color: white; font-family: "Verdana"; font-size: x-small;';
			config.debug = 0;
			
			// NOTE:  You can remove any of these blocks and use the default config!
			
			config.toolbar = [
				['fontname'],
				['fontsize'],
				['HorizontalRule','InsertTable','Createlink','InsertImage','htmlmode'],
				['linebreak'],
				['bold','italic','underline','separator'],
				['strikethrough','subscript','superscript','separator'],
				['justifyleft','justifycenter','justifyright','separator'],
				['OrderedList','UnOrderedList','Outdent','Indent','separator'],
				['forecolor','backcolor'],
			];
			
			editor_generate('edit_text_welcome',config);
		  </script>
		  <?PHP } ?>
		</td>
		</tr>
		<tr> 
		  <td class="sxTdItem"><?PHP echo $sxLang['PreferencesItemHeaderText']; ?><br />
		  </td>
		  <td><textarea name="edit_text_header" style="width:450px;height:100px;"><?PHP echo $sxSetup['TextHeader']; ?></textarea></td>
		</tr> 
		  <tr> 
			<td class="sxTdItem" width="170"><?PHP echo $sxLang['PreferencesItemHomepageItems']; ?></td>
			<td><input name="edit_show_login" type="checkbox" value="1"<?PHP if($sxSetup['ShowLogin']) echo ' checked="checked"'; ?> /> <?PHP echo $sxLang['PreferencesItemShowLogin']; ?><br />
          <input name="edit_show_search" type="checkbox" value="1"<?PHP if($sxSetup['ShowSearch']) echo ' checked="checked"'; ?> /> <?PHP echo $sxLang['PreferencesItemShowSearch']; ?><br />
          <input name="edit_homepage_show_photos" type="checkbox" value="1"<?PHP 			if($sxSetup['HomepageRandomPhotos'] == 1) 	echo ' checked="checked"'; ?> /> <?PHP 	echo $sxLang['PhotoOptionsSectionRandom']; ?><br />
			    <input name="edit_homepage_show_recentcomments" type="checkbox" value="1"<?PHP 	if($sxSetup['HomepageRecentComments'] == 1) echo ' checked="checked"'; ?> /> <?PHP 	echo $sxLang['CommentsRecent']; ?><br />
			    <input name="edit_homepage_show_recenttopics" type="checkbox" value="1"<?PHP 	if($sxSetup['HomepageRecentTopics'] == 1) 	echo ' checked="checked"'; ?> /> <?PHP 	echo $sxLang['ForumRecentTopics']; ?><br />
			    <input name="edit_homepage_show_upcomingevents" type="checkbox" value="1"<?PHP 	if($sxSetup['HomepageUpcomingEvents'] == 1) echo ' checked="checked"'; ?> /> <?PHP 	echo $sxLang['EventFilterUpcoming']; ?><br />
			    <input name="edit_homepage_show_currentpoll" type="checkbox" value="1"<?PHP 	if($sxSetup['HomepageCurrentPoll'] == 1) 	echo ' checked="checked"'; ?> /> <?PHP 	echo $sxLang['PollsCurrentPoll']; ?><br />
			    <input name="edit_homepage_show_minicalendar" type="checkbox" value="1"<?PHP 	if($sxSetup['HomepageMiniCalendar'] == 1) 	echo ' checked="checked"'; ?> /> <?PHP 	echo $sxLang['PreferencesItemHomepageItemsMiniCal']; ?><br />
			</td>
		  </tr>
		  </table>
	  <p align="center"><input type="submit" name="Submit" value="<?PHP echo $sxLang['HomeManagerButtonUpdate']; ?>" class="sxButton" /></p>
	</form>
	</div>
	  <!-- background refresh -->
<iframe src ="../includes/session_keepalive.php?interval=<?PHP echo $sxThemeConfig['AdminKeepAlive']; ?>&bgcolor=<?PHP echo urlencode($sxThemeConfig['SiteBaseColor']); ?>" scrolling="no" height="1" marginheight="0" marginwidth="0" frameborder="0" align="right" width="1"></iframe>
<?PHP
include("../themes/$THEME_FOLDER/footer.php");
ob_end_flush();
?>
Return current item: SiteX