Location: PHPKode > projects > Exero CMS > upload/install/resource/functions.php
<?
/*========================================*\
| Exero CMS                                |
|==========================================|
|          http://ecms.getox.net           |
|https://sourceforge.net/projects/exerocms/|
|==========================================|
|     Exero CMS is released under the      |
|     GNU General Public License (GPL)     |
| opensource.org/licenses/gpl-license.php  |
\*========================================*/


function print_header($info='',$version='') {
global $installinfo,$upgradeinfo,$globalinfo,$ecms;
	print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Exero CMS</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="install.css" />

</head>
<body>
<div class="header">
	<div>
		<table width="100%" height="69" border="0" cellspacing="0" cellpadding="0" align="center">
		  <tr>
			<td valign="center">
				<h1>Exero CMS</h1>';
				
				if(!$version == "") {
					print "Version ".$version;
				}
	print '	</td>
			<td valign="center" align="right">
				<div class="info">
				'.$info.'
				</div>
			</td>
		  </tr>
		</table>
	</div>
</div>
<div class="content">';
}

function print_footer($version='') {
global $installinfo, $upgradeinfo;
	if($version == "") {
		if(isset($installinfo['appver'])) {
			$version = $installinfo['appver'];
		} else if(isset($upgradeinfo['appver'])) {
			$version = $upgradeinfo['appver'];
		}
	}
	print "</div>\n";
	print "<div class=\"footer\">Exero CMS <!--".$version."--><br />Copyright 2006 Getox.net</div>";
	print "</body>\n";
	print "</html>";
}

// Table Header
function print_table_header($title,$collspan='0',$cpad='0',$cspace='0',$width='100%',$border='ignore') {
	print "<table width=\"".$width."\" cellpadding=\"".$cpad."\" cellspacing=\"".$cspace."\" class=\"tborder\"";
	if($border == "noborder") {
		print " style=\"border: 0px;\"";
	} else if($border == "ignore") {
	}
	print ">\n";
	print "<tr>\n";
	print "<td id=\"table_header\" colspan=\"".$collspan."\">".$title."</td>\n";
	print "</tr>\n";
	$bgcounter = 0;
}
// Table Row
function print_table_row($text,$colspan='0') {
$id = fetch_row_bgclass();
	print "<tr>\n";
	print "<td id=\"".$id."\" colspan=\"".$colspan."\">".$text."</td>\n";
	print "</tr>\n";
}
// Table Row2
function print_table_row2($text,$text2,$width='100%') {	$id = fetch_row_bgclass();
	print "<tr>\n";
	print "<td id=\"".$id."\" width=\"".$width."\"><strong>".$text."</strong></td>\n";
	print "<td id=\"".$id."\">".$text2."</td>\n";
	print "</tr>\n";
}
// Option Row
function print_table_optiontitle($text,$title='',$colspan='0') {
	print "<tr>\n";
	print "<td colspan=\"$colspan\" title=\"$title\" id=\"optiontitle\">".$text."</td>\n";
	print "</tr>\n";
}
// Table Footer
function print_table_footer() {
	print "</table><br>\n";
}
// Form Header
function print_form_header($action,$name='form1',$mothod='POST') {
	print "<form name=\"".$name."\" action=\"".$action."\" method=\"".$mothod."\" enctype=\"multipart/form-data\">\n";
}
// Form Footer
function print_form_footer() {
	print "</form>\n";
}
// Form Textbox
function print_form_textbox($text,$name,$value='') {	
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\">".$text."</td>";
	print "<td id=\"".$id."\" width=\"120\"><input type=\"text\" name=\"".$name."\" value=\"".$value."\" id=\"textbox\"></td>\n";
	print "</tr>\n";
}
// Form Passbox
function print_form_passbox($text,$name,$value='') {	
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\">".$text."</td>";
	print "<td id=\"".$id."\"width=\"120\"><input type=\"password\" name=\"".$name."\" value=\"".$value."\" id=\"textbox\"></td>\n";
	print "</tr>\n";
}
// Form Textarea
function print_form_textarea($text,$name,$value='',$cols='',$rows='',$textareawidth='200px') {	
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\">".$text."</td>";
	print "<td id=\"".$id."\" width=\"120\"><textarea name=\"".$name."\" cols=\"".$cols."\" rows=\"".$rows."\" style=\"width: $textareawidth;\">".$value."</textarea></td>\n";
	print "</tr>\n";
}
// Form Textarea Row
function print_form_textarearow($name,$value='',$colspan='0',$cols='',$rows='',$textareawidth='200px') {	
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\" colspan=\"".$colspan."\" align=\"center\"><textarea name=\"".$name."\" cols=\"".$cols."\" rows=\"".$rows."\" style=\"width: $textareawidth;\">".$value."</textarea></td>\n";
	print "</tr>\n";
}
// Form Submit
function print_form_submit($text,$colspan='0',$reset='1') {
	print "<tr valign=\"top\">\n";
	print "<td id=\"form_submit_td\" colspan=\"".$colspan."\"><div align=\"center\"><button type=\"submit\">".$text."</button>&nbsp;&nbsp;&nbsp;".iif($reset,"<button type=\"reset\">Reset</button>")."</div></td>\n";
	print "</tr>";
}
// Form Hiddenfield
function print_form_hiddenfield($name,$value) {
	print "<input type=\"hidden\" name=\"".$name."\" value=\"".$value."\">\n";
}
// Form Select
function print_form_select($text,$name,$size,$options,$selected='',$shownone='1') {
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\">".$text."</td>";
	print "<td id=\"".$id."\"width=\"120\">\n<select name=\"$name\" size=\"$size\">\n";
	if($shownone) {
		print "<option>None</option>\n";
	}
	//print_r($options);
	$selected = explode(',',$selected);
	foreach($options as $value => $option) {
		if(in_array($value,$selected)) {
			print "<option value=\"$value\" selected>$option</option>\n";
		} else {
			print "<option value=\"$value\">$option</option>\n";
		}
	}
	print "</select>\n</td>\n";
	print "</tr>\n";
}
// Yes No Options
function print_form_yesno($text,$name,$value='') {
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\">".$text."</td>";
	if($value == "1") {
		print "<td id=\"".$id."\" width=\"120\"><label><input name=\"".$name."\" type=\"radio\" value=\"1\" checked>Yes</label> <label><input name=\"".$name."\" type=\"radio\" value=\"0\">No</label></td>\n";
	} else {
		print "<td id=\"".$id."\" width=\"120\"><label><input name=\"".$name."\" type=\"radio\" value=\"1\">Yes</label> <label><input name=\"".$name."\" type=\"radio\" value=\"0\" checked>No</label></td>\n";
	}
	print "</tr>\n";
}
// Row BG Class
function fetch_row_bgclass()
{
	global $bgcounter;
	return ($bgcounter++ % 2) == 0 ? 'alt1' : 'alt2';
}
function iif($expression, $returntrue, $returnfalse = '')
{
	return ($expression ? $returntrue : $returnfalse);
}

function print_login() {
	print_header();
	print_form_header($_SERVER['PHP_SELF'],"settings");
	print_table_header("Enter Database Name","2");
	print_table_optiontitle("Enter the database name to continue",'','2');
	print_form_textbox("Database Name","database");
	print_form_submit("Continue",2,0);
	print_table_footer();
	print_form_footer();
	print_footer();
}

function print_stepinfo($step,$buttontext,$stepinfo='',$showbutton=1) {
	print "<div class=\"stepinfo\">\n";
	print "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"6\" class=\"footbuttons\">\n";
	print "<tr>\n";
	print "<td width=\"50%\">$stepinfo</td>\n";
	if($showbutton) {
		print "<td align=\"right\"><button type=\"submit\">$buttontext</button></td>\n";
	}
	print "</tr>\n";
	print "</table>\n";
	print "</div>\n";
}
?>
Return current item: Exero CMS