) * @var string */ var $realm = '[UNDEFINED REALM]'; /** * CSS to place in the page * @var string */ var $css = ''; /** * Constructor */ function __construct(&$registry) { $this->registry =& $registry; } /** * (PHP 4) Constructor */ function Printer(&$registry) { $this->__construct($registry); } /** * Creates a redirect to another page; constructs the header and footer (therefore execution stops) * * @param string Location to redirect to * @param integer Time to wait before the redirect */ function redirect($location, $timeout = 10) { $timeout = $timeout * 200; $js = << EOD; $this->page_start($this->registry->modules['localize']->string('Redirect'), ':default:', 15, $js); $this->page_message($this->registry->modules['localize']->string('Redirect'), sprintf($this->registry->modules['localize']->string('Please wait to be redirected. If you are not redirected in a few seconds, click here.'), $location)); $this->page_end(); } /** * Throws a fatal error; constructs the header and footer * * @param string Error messsage text */ function error($message) { $this->page_start($this->registry->modules['localize']->string('Error')); $this->page_message($this->registry->modules['localize']->string('Error'), $message); $this->page_end(); exit; } // ################################################################### /** * Outputs the header of the page: doctype, , , , <body> * and imbeds the style information * * @param string Title of the page * @param string Class of the page to be applied to the body * @param integer Margin of the <div> that all content is placed in * @param string Extra HTML to imbed in the <head> tag * @param string <body> onLoad action to imbed * @param integer Margin of the actual <body > tag * @param string Relative path where the CSS data is stored * @param bool Will force re-print the header if it has already been printed */ function page_start($actiontitle, $pageclass = ':default:', $pagemargin = 15, $extra = '', $onload = false, $margin = 0, $dotpath = '.', $override = false) { if ($this->registry->debug AND isset($_GET['query'])) { ob_start(); } if (defined('DONE_HEADER') AND !$override) { if (constant('DONE_HEADER') AND !$override) { return; } } $title = sprintf($this->registry->modules['localize']->string('%1$s - %2$s - %3$s'), $this->registry->application, $this->realm, $actiontitle); echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>"; echo "\n\t<title>$title"; echo "\n\t"; echo $this->css; echo ($extra ? "\n$extra" : ''); echo "\n\n\n"; if (!defined('HIDE_SETUP') AND function_exists('_printer_page_start')) { _printer_page_start(); } echo "
\n\n\n"; if (!defined('DONE_HEADER')) { define('DONE_HEADER', 1); } } /** * Links CSS to the page from a given relative path * * @param string Relative path to the CSS file */ function css_link($path) { $this->css .= "\n\t"; } /** * Imbeds actual CSS information into the page in "; } /** * Places raw HTML code directly into the documet at the current position * * @param string HTML code */ function page_code($code) { echo "\n\n$code\n\n"; } /** * A block function that produces a table with a message in it. This does not print the header and footer * * @param string The title of the message (appears at the top of the block) * @param string Content of the message */ function page_message($title, $message) { $this->table_start(true, '75%'); $this->table_head($title, 1); $this->row_span("
$message
", ':swap:', 'left', 1); $this->table_end(); } /** * Produces an entire page layout that asks the user whether or not they want to perform X action and provides * a link to the YES and NO action * * @param string Message that asks if they want to do X * @param string Location to go for YES * @param string DO action to pass * @param array Hidden parameters to pass to the next page */ function page_confirm($message, $location, $action, $params) { $this->page_start($this->registry->modules['localize']->string('Confirm')); $this->form_start($location, $action); foreach ($params AS $key => $value) { $this->form_hidden_field($key, $value); } $this->table_start(true, '75%'); $this->table_head($this->registry->modules['localize']->string('Confirm'), 1); $this->row_span("
$message
", ':swap:', 'left', 1); $this->row_submit('', $this->registry->modules['localize']->string('Yes'), ''); $this->table_end(); $this->form_end(); $this->page_end(); } /** * Closes the HTML document structure an adds the copyright; this also stops execution of the page */ function page_end() { if ($this->registry->debug AND isset($_GET['query'])) { ob_clean(); ob_end_clean(); if (is_array($this->registry->modules['db_mysql']->history)) { echo '
';
				foreach ($this->registry->modules['db_mysql']->history AS $query)
				{
					echo $query . "\n\n
\n\n"; } echo '
'; } exit; } $copyright = "\n
\n

\n\t" . $this->registry->application . ' ' . $this->registry->appversion . ", © 2002 - " . date('Y') . " Iris Studios, Inc.\n

"; if (!defined('HIDE_SETUP')) { echo "\n\n
\n$copyright"; } else { echo "\n\n"; } if ($this->registry->debug) { // source control $scinfo = 'Not Under Source Control'; $possiblescms = array('cvs', 'svn', 'cvs_information', 'svn_information', 'scm', 'sc_information', 'scm_information'); foreach ($possiblescms AS $scm) { if (defined(strtoupper($scm))) { $scinfo = constant(strtoupper($scm)); $type = ''; // CVS if (strpos($scinfo, 'RCSfile:') !== false) { $type = 'cvs'; } else if (strpos($scinfo, ',v ') !== false) { $type = 'cvs'; } // SVN else if (strpos($scinfo, 'URL:') !== false) { $type = 'svn'; } else if (strpos($scinfo, 'https://') !== false OR strpos($scinfo, 'http://') !== false) { $type= 'svn'; } // not found so just return it // try a SVN ID tag as we can't really tell if we're using it else { $test = preg_replace('#\$' . 'Id: (.+?) (.+?) [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.+?) (.+?) \$#', '\\1 - SVN \\2', $scinfo); if ($test == '$' . 'Id: $') { $scinfo = 'Not Under Source Control'; } else { $scinfo = $test; } break; } if ($type == 'cvs') { $scinfo = preg_replace('#\$' . 'RCSfile: (.+?) \$#', '\\1', $scinfo); $scinfo = preg_replace('#\$' . 'Revision: (.+?) \$#', 'CVS \\1', $scinfo); $scinfo = preg_replace('#\$' . 'Id: (.+?) (.+?) [0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} (.+?) (.+?) \$#', '\\1 - CVS \\2', $scinfo); } else if ($type == 'svn') { $scinfo = preg_replace('#\$' . '(Head)?URL: (.+?) \$#e', "end(explode('/', '\\2'))", $scinfo); $scinfo = preg_replace('#\$' . '(LastModified)?Revision: (.+?) \$#', 'SVN \\2', $scinfo); $scinfo = preg_replace('#\$' . 'Id: (.+?) ([0-9].+?) [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.+?) (.+?) \$#', '\\1 - SVN \\2', $scinfo); } else { $scinfo = 'Not Under Source Control'; } break; } } $scinfo = trim($scinfo); $debug = "\n\t
  • Source Control: $scinfo
  • "; // query information if (is_object($this->registry->modules['db_mysql'])) { $debug .= "\n\t
  • Total Queries: " . sizeof($this->registry->modules['db_mysql']->history) . " (registry->sanitize($_SERVER['REQUEST_URI']) . ((strpos($_SERVER['REQUEST_URI'], '?') !== false) ? '&query=1' : '?query=1') . "\">?)
  • "; } // total execution time if (defined('ISSO_MT_START')) { $this->registry->load('functions', 'functions'); $debug .= "\n\t
  • Total Execution Time: " . round($this->registry->modules['functions']->fetch_microtime_diff(ISSO_MT_START), 10) . "
  • "; } // debug notices $debug .= "\n\t
  • \n\t\t\n\t
  • "; // loaded modules $modules = $this->registry->show_modules(true); $debug .= "\n\t
  • \n\t\t\n\t
  • "; // --- END $debug .= "\n"; $debug = "\n
    \n" . $this->registry->message('Debug Information', $debug, 1, true, false); echo "\n\n\n
    \n$debug\n
    \n\n\n"; } echo "\n\n\n"; exit; } // ################################################################### /** * Opens a tag with styling * * @param bool Whether to add a
    before the table * @param string Value of the width attribute */ function table_start($break = true, $width = '90%') { if ($break) { echo '
    '; } echo "\n
    \n"; } /** * Adds a table row that is sued to head the entire table * * @param string Title string * @param integer Colspan attribute value * @param bool Whether to bold the title */ function table_head($title, $colspan = 2, $strong = true) { echo "\n\t\n\n"; } /** * Creates column headings; useful for a grid-style page. This uses a different styling than table_head() * and is usually used directly after a table header * * @param array Array of titles to print */ function table_column_head($columnarray) { if (is_array($columnarray)) { $render = "\n"; foreach ($columnarray AS $header) { $render .= "\t\n"; } $render .= "\n"; echo $render; } } /** * Closes a
    " . (($strong) ? "$title" : $title) . "
    $header
    tag */ function table_end() { echo "\n
    \n"; } // ################################################################### /** * Starts a
    tag and adds the DO hidden input field * * @param string Action/name of the file to action to * @param string Value of the DO parameter; used to do-branch * @param bool Enctype attribute; used for mime/multi-part * @param string Name of the form; this only matters for DOM access * @param string Method to action as; POST or GET (default is POST) */ function form_start($action, $do, $enctype = false, $name = 'inputform', $submitmethod = 'post') { echo "\n\n\n"; $this->form_hidden_field('do', $do); } /** * Adds a hidden field at the current location * * @param string Name of the field * @param string Value of the field */ function form_hidden_field($name, $value) { echo "\n"; } /** * Closes a tag */ function form_end() { echo "
    \n\n"; } // ################################################################### /** * Creates a table row that spans an entire row; this is used to divide sections, usually * * @param string Text to place in the row * @param string Class name to style with; by default it alternates between alt1 and alt2 (use :swap: to do that) * @param string Alignment of the text in the row * @param integer Colspan attribute */ function row_span($text, $class = ':swap:', $align = 'left', $colspan = 2) { if ($class === ':swap:') { $this->registry->modules['functions']->exec_swap_bg(); $row_class = $this->registry->modules['functions']->bgcolour; $is_style_element = false; } else { if (preg_match('#:style:(.*?)#i', $class)) { $is_style_element = true; $style = str_replace(':style:', '', $class); } else { $row_class = $class; $is_style_element = false; } } echo "\n\n\t$text\n"; } /** * Creates a table row that has more than two columns; this is used in conjunction with table_column_head() * usually; it takes an array of values * * @param array Array of values in form value => alignment key (c for center, l for left, and r for right) */ function row_multi_item($row_array) { $this->registry->modules['functions']->exec_swap_bg(); foreach ($row_array AS $item => $align) { $row_data["$align"][] = $item; } echo ""; foreach ($row_data AS $align_key => $item_array) { if ($align_key == 'c') { $align = 'center'; } else if ($align_key == 'l') { $align = 'left'; } else if ($align_key == 'r') { $align = 'right'; } foreach ($item_array AS $value) { echo "\n\tregistry->modules['functions']->bgcolour}\" align=\"$align\">$value"; } } echo "\n\n"; } /** * Generic row creation function that has two columns: label and value; this is used for many * other form functions, but can also be used for non-editable fields * * @param string Label text * @param string HTML or text to place in the value column * @param string Vertical align (valign attribute) for the row * @param integer Colspan attribute * @param string Class to style the row with; default is to alternate */ function row_text($label, $value = ' ', $valign = 'top', $colspan = 2, $class = -1) { global $IS_SETTINGS; if ($class == -1) { if (!$IS_SETTINGS) { $this->registry->modules['functions']->exec_swap_bg(); $row_class = $this->registry->modules['functions']->bgcolour; } else { $row_class = 'alt2'; } } else { $row_class = $class; } echo ""; echo "\n\t$label"; echo "\n\t$value"; if ($colspan > 2) { echo "\n\t "; } echo "\n\n"; } /** * Creates a table row with an text field as the value column * * @param string Label text * @param string Name of the field * @param string Value of the field * @param integer Colspan attribute * @param integer Size of the field * @param integer Length attribute; use FALSE for no length to be specified * @param bool Whether to make this a password field * @param string Vertical align (valign attribute) */ function row_input($label, $name, $value = '', $colspan = 2, $size = 35, $length = false, $password = false, $lalign = 'top') { $this->row_text($label, "", $lalign, $colspan); } /** * Creates a table row with a ", 'top', $colspan); } /** * Creates a table row with the tfoot class * * @param string Extra text or HTML to insert into the row * @param integer Colspan attribute */ function row_tfoot($data, $colspan = 2) { echo $this->row_span($data, 'tfoot', 'center', $colspan); } /** * Creates a tfoot table row with submit buttons * * @param string Extra HTML to imbed in the row after the buttons * @param string Submit button text (by default it uses pre-translated "Submit" from :save:) * @param string Reset button text (default it uses pre-translated "Reset" from :reset:) * @param integer Colspan attribute */ function row_submit($extra = false, $submit = ':save:', $reset = ':reset:', $colspan = 2) { if ($submit === ':save:') { $submit = " " . $this->registry->modules['localize']->string('Submit') . " "; } else { $submit = " $submit "; } if ($reset === ':reset:') { $reset = " " . $this->registry->modules['localize']->string('Reset') . " "; } else { $reset = (($reset) ? " $reset " : ''); } $output = "\n\t\t"; $output .= ($reset ? "\n\t\t" : ''); $output .= ($extra ? "\n\t\t$extra" : ''); $output .= "\n\t"; $this->row_tfoot($output, $colspan); } /** * Creates an upload row; you need to specify some other paramaters in form_start() for this to work * * @param string Label text * @param string Upload name * @param integer Colspan attribute */ function row_upload($label, $name, $colspan = 2) { $this->row_text($label, "", 'top', $colspan); } /** * Adds a name-value pair to an array that is constructed into a table row from list_item() items * * @param string Label text * @param string Name of the $optionlist\n" . (($is_jump) ? "\nregistry->modules['localize']->string('Go') . " \" accesskey=\"g\" />" : '') . "\n", $colspan); } /** * Creates a row with two radio buttons: yes and now * * @param string Label text * @param string Name of the BOOL flag * @param bool TRUE to select the YES by default; FALSE for NO * @param integer Colspan attribute */ function row_yesno($label, $name, $value, $colspan = 2) { $this->row_text($label, " " . $this->registry->modules['localize']->string('Yes') . " " . $this->registry->modules['localize']->string('No'), $colspan); } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>