View file dotwidgeta/admin/editconfig.php

File size: 10.23Kb
<?php
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, max-age=0, post-check=0, pre-check=0");
header("Pragma: no-cache");

include("dotwidgeta_config.php"); // change if the config file is not in admin directory
$metatitle = $sitename . " - Edit Configuration";
include($admin_header_file);

print "<blockquote><p class=\"PAGEHEADING\">Admin: Edit Configuration";

print "<P><A HREF=\"index.php\">Main Menu</A></p>";

if ($submit): 

global $sitename, $articles_area_name, $db_host, $db_name, $db_user;
global $dw_id, $dw_pw;
global $db_pw, $file_path, $header_file, $footer_file, $admin_header_file;
global $admin_footer_file, $css_file, $admin_css_file, $latest_limit;
global $nav_location, $nav_selector_type, $use_markup;

$sitename = $a_sitename;
$articles_area_name = $a_articles_area_name;
$db_host = $a_db_host;
$db_name = $a_db_name;
$db_user = $a_db_user;
$db_pw = $a_db_pw;
$dw_id = $a_dw_id;
$dw_pw = $a_dw_pw;
$file_path = $a_file_path;
$header_file = $a_header_file;
$footer_file = $a_footer_file;
$admin_header_file = $a_admin_header_file;
$admin_footer_file = $a_admin_footer_file;
$css_file = $a_css_file;
$admin_css_file = $a_admin_css_file;
$latest_limit = $a_latest_limit;
$nav_location = $a_nav_location;
$nav_selector_type = $a_nav_selector_type;
$use_markup = $a_use_markup;

$config_file = "dotwidgeta_config.php";

$data = "";
$data .= "<?php\n";
$data .= "\$sitename = \"$sitename\";\n";
$data .= "\$articles_area_name = \"$articles_area_name\";\n";
$data .= "\$db_host = \"$db_host\";\n";
$data .= "\$db_name = \"$db_name\";\n";
$data .= "\$db_user = \"$db_user\";\n";
$data .= "\$db_pw = \"$db_pw\";\n";
$data .= "\$dw_id = \"$dw_id\";\n";
$data .= "\$dw_pw = \"$dw_pw\";\n";
$data .= "\$file_path = \"$file_path\";\n";
$data .= "\$header_file = \"$header_file\";\n";
$data .= "\$footer_file = \"$footer_file\";\n";
$data .= "\$admin_header_file = \"$admin_header_file\";\n";
$data .= "\$admin_footer_file = \"$admin_footer_file\";\n";
$data .= "\$css_file = \"$css_file\";\n";
$data .= "\$admin_css_file = \"$admin_css_file\";\n";
$data .= "\$latest_limit = \"$latest_limit\";\n";
$data .= "\$nav_location = \"$nav_location\";\n";
$data .= "\$nav_selector_type = \"$nav_selector_type\";\n";
$data .= "\$use_markup = \"$use_markup\";\n";
$data .= '?>';

// open and write and close file
$fp = @fopen($config_file, "w");
if(!$fp) {
$file_message = "Error: cannot open config file for writing<br>";
}

$fw = @fwrite($fp, $data);
if($fw == -1) {
  $file_message = "Error: cannot write config file; lacking permissions?<br>";
  fclose($fp);
} else {
  $file_message = "Update successful<br><br>";
} 
fclose($fp);
echo($file_message);

?>

<?php else: ?>

<FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=POST>

<H4>Site/Area Names:</H4>
<TABLE WIDTH="90%" BORDER=1 CELLPADDING=5>
<TR VALIGN="TOP">
	<TD WIDTH="25%">Site Name:</TD>
	<TD WIDTH="40%">
	<INPUT TYPE=TEXT NAME="a_sitename" VALUE="<?php echo($sitename); ?>" SIZE=25 MAXLENGTH=100>
	</TD>
	<TD WIDTH="35%"><P>
	Enter the name of your site. This will appear at the top of your admin and display pages.<br><span class="TIPTEXT">($sitename)</span>
	</P></TD>
</TR>

<TR VALIGN="TOP">
	<TD>Area Name:</TD>
	<TD>
	<INPUT TYPE=TEXT NAME="a_articles_area_name" VALUE="<?php echo($articles_area_name); ?>" SIZE=25 MAXLENGTH=100>
	</TD>
	<TD><P>
	Enter the name of your articles area. This will appear at the top of your admin and display pages.<br><span class="TIPTEXT">($articles_area_name)</span>
	</P></TD>
</TR>
</TABLE>

<H4>Database:</H4>
<TABLE WIDTH="90%" BORDER=1 CELLPADDING=5>
<TR VALIGN="TOP">
	<TD WIDTH="25%">Database Host:</TD>
	<TD WIDTH="40%">
	<INPUT TYPE=TEXT NAME="a_db_host" VALUE="<?php echo($db_host); ?>" SIZE=25 MAXLENGTH=100>
	</TD>
	<TD WIDTH="35%"><P>
	The host address of your mySQL server (usually "localhost")<br><span class="TIPTEXT">($db_host)</span>
	</P></TD>
</TR>

<TR VALIGN="TOP">
	<TD>Database Name:</TD>
	<TD>
	<INPUT TYPE=TEXT NAME="a_db_name" VALUE="<?php echo($db_name); ?>" SIZE=25 MAXLENGTH=100>
	</TD>
	<TD><P>
	The name of your mySQL database<br><span class="TIPTEXT">($db_name)</span>
	</P></TD>
</TR>

<TR VALIGN="TOP">
	<TD>User Name:</TD>
	<TD>
	<INPUT TYPE=TEXT NAME="a_db_user" VALUE="<?php echo($db_user); ?>" SIZE=25 MAXLENGTH=100>
	</TD>
	<TD><P>
	Your mySQL user name<br><span class="TIPTEXT">($db_user)</span>
	</P></TD>
</TR>

<TR VALIGN="TOP">
	<TD>Database Password:</TD>
	<TD>
	<INPUT TYPE=TEXT NAME="a_db_pw" VALUE="<?php echo($db_pw); ?>" SIZE=25 MAXLENGTH=100>
	</TD>
	<TD><P>
	Your mySQL password<br><span class="TIPTEXT">($db_pw)</span>
	</P></TD>
</TR>
</TABLE>


<H4>dotWidget Admin ID & Password:</H4>
<TABLE WIDTH="90%" BORDER=1 CELLPADDING=5>
<TR VALIGN="TOP">
	<TD width="25%">dotWidget Admin User Name:</TD>
	<TD width="40%">
	<INPUT TYPE=TEXT NAME="a_dw_id" VALUE="<?php echo($dw_id); ?>" SIZE=25 MAXLENGTH=100>
	</TD>
	<TD width="35%"><P>
	The dotWidget Admin area is password protected. Change the default ID of "dotwidget".<br><span class="TIPTEXT">($dw_id)</span>
	</P></TD>
</TR>

<TR VALIGN="TOP">
	<TD>dotWidget Admin Password:</TD>
	<TD>
	<INPUT TYPE=TEXT NAME="a_dw_pw" VALUE="<?php echo($dw_pw); ?>" SIZE=25 MAXLENGTH=100>
	</TD>
	<TD><P>
		The dotWidget Admin area is password protected. Change the default password.<br><span class="TIPTEXT">($dw_pw)</span>
	</P></TD>
</TR>
</TABLE>

<H4>File Paths:</H4>
<TABLE WIDTH="90%" BORDER=1 CELLPADDING=5>

<TR VALIGN="TOP">
	<TD WIDTH="25%">File Path:</TD>
	<TD WIDTH="40%">
	<INPUT TYPE=TEXT NAME="a_file_path" VALUE="<?php echo($file_path); ?>" SIZE=35 MAXLENGTH=100>
	</TD>
	<TD WIDTH="35%"><P>
	Enter the file path (ending in a slash"/") that points to the directory containing the dotWidget code.<br><span class="TIPTEXT">($file_path)</span>
	</P></TD>
</TR>

<TR VALIGN="TOP">
	<TD>Display Header:</TD>
	<TD>
	<INPUT TYPE=TEXT NAME="a_header_file" VALUE="<?php echo($header_file); ?>" SIZE=35 MAXLENGTH=100>
	</TD>
	<TD><P>
	The include file that will drop HTML at the top of all display pages<br><span class="TIPTEXT">($header_file)</span>
	</P></TD>
</TR>

<TR VALIGN="TOP">
	<TD>Display Footer:</TD>
	<TD>
	<INPUT TYPE=TEXT NAME="a_footer_file" VALUE="<?php echo($footer_file); ?>" SIZE=35 MAXLENGTH=100>
	</TD>
	<TD><P>
	The include file that will drop HTML at the bottom of all display pages<br><span class="TIPTEXT">($footer_file)</span>
	</P></TD>
</TR>

<TR VALIGN="TOP">
	<TD>Display CSS File:</TD>
	<TD>
	<INPUT TYPE=TEXT NAME="a_css_file" VALUE="<?php echo($css_file); ?>" SIZE=35 MAXLENGTH=100>
	</TD>
	<TD><P>
	The Cascading Style Sheets file that will be used for display pages<br><span class="TIPTEXT">($css_file)</span>
	</P></TD>
</TR>

<TR VALIGN="TOP">
	<TD>Admin Header:</TD>
	<TD>
	<INPUT TYPE=TEXT NAME="a_admin_header_file" VALUE="<?php echo($admin_header_file); ?>" SIZE=35 MAXLENGTH=100>
	</TD>
	<TD><P>
	The include file that will drop HTML at the top of all admin (like this one) pages.<br><span class="TIPTEXT">($admin_header_file)</span>
	</P></TD>
</TR>

<TR VALIGN="TOP">
	<TD>Admin Footer:</TD>
	<TD>
	<INPUT TYPE=TEXT NAME="a_admin_footer_file" VALUE="<?php echo($admin_footer_file); ?>" SIZE=35 MAXLENGTH=100>
	</TD>
	<TD><P>
	The include file that will drop HTML at the bottom of all admin pages (like this one).<br><span class="TIPTEXT">($admin_footer_file)</span>
	</P></TD>
</TR>

<TR VALIGN="TOP">
	<TD>Admin CSS File:</TD>
	<TD>
	<INPUT TYPE=TEXT NAME="a_admin_css_file" VALUE="<?php echo($admin_css_file); ?>" SIZE=35 MAXLENGTH=100>
	</TD>
	<TD><P>
	The Cascading Style Sheets file that will be used for admin pages (like this one).<br><span class="TIPTEXT">($admin_css_file)</span>
	</P></TD>
</TR>
</TABLE>

<H4>Display Settings:</H4>
<TABLE WIDTH="90%" BORDER=1 CELLPADDING=5>
<TR VALIGN="TOP">
	<TD WIDTH="25%">"Most Recent" Limit:</TD>
	<TD WIDTH="40%">
	<INPUT TYPE=TEXT NAME="a_latest_limit" VALUE="<?php echo($latest_limit); ?>" SIZE=5 MAXLENGTH=10>
	</TD>
	<TD WIDTH="35%"><P>
	By default, the display home page lists summaries of and links to the most recent articles. "How many" of the most recent articles is determined by this number.<br><span class="TIPTEXT">($latest_limit)</span>
	</P></TD>
</TR>

<TR VALIGN="TOP">
	<TD>Navigator Location:</TD>
	<TD>
	<SELECT NAME="a_nav_location" SIZE=1>
	<OPTION SELECTED VALUE="<?php echo($nav_location); ?>"><?php echo($nav_location); ?>
	<?php if($nav_location == "top"): ?>
		<OPTION VALUE="left side">left side
		<?php else: ?>
		<OPTION VALUE="top">top
		<?php endif; ?>
	</SELECT>
	</TD>
	<TD><P>
	For display pages, the current list of categories will be displayed as a menu either at the top of the page or down the left side. You make the call.<br><span class="TIPTEXT">($nav_location)</span>
	</P></TD>
</TR>

<TR VALIGN="TOP">
	<TD>Navigator Selector Type:</TD>
	<TD>
	<SELECT NAME="a_nav_selector_type" SIZE=1>
	<OPTION SELECTED VALUE="<?php echo($nav_selector_type); ?>"><?php echo($nav_selector_type); ?>
	<?php if($nav_selector_type == "select box"): ?>
		<OPTION VALUE="text links">text links
		<?php else: ?>
		<OPTION VALUE="select box">select box
		<?php endif; ?>
	</SELECT>
	</TD>
	<TD><P>
	For display pages, the current list of categories will be displayed either as a select box or as a set of text links. It's your choice.<br><span class="TIPTEXT">($nav_selector_type)</span>
	</P></TD>
</TR>

<TR VALIGN="TOP">
	<TD>Use Markup Tags?</TD>
	<TD>
	<SELECT NAME="a_use_markup" SIZE=1>
	<OPTION SELECTED VALUE="<?php echo($use_markup); ?>"><?php echo($use_markup); ?>
	<?php if($use_markup == "Yes"): ?>
		<OPTION VALUE="No">No
		<?php else: ?>
		<OPTION VALUE="Yes">Yes
		<?php endif; ?>
	</SELECT>
	</TD>
	<TD><P>
	"No" means that HTML in article content will be escaped (rendered as text on the screen.<br><span class="TIPTEXT">($use_markup)</span>
	</P></TD>
</TR>

</TABLE>

<BR>
<TABLE WIDTH="90%" BORDER=0 CELLPADDING=5>
<TR>
	<TD WIDTH="25%">&nbsp;</TD>
	<TD WIDTH="40%">
	<INPUT TYPE=SUBMIT NAME="submit" VALUE="Save your Configuration changes">
	</TD>
	<TD WIDTH="35%">&nbsp;</TD>
</TR>
</TABLE>

</FORM><BR>

<?php endif; 
include($admin_footer_file);
?>