| <?php |
| |
| |
| |
| |
| class HTML |
| { |
| |
| |
| |
| |
| function format_htmlblock( $htmlblock = array() ) |
| { |
| $html_formatted = ''; |
| |
| |
| $tabs = array(0 => '', |
| 1 => "\t", |
| 2 => "\t\t", |
| 3 => "\t\t\t", |
| 4 => "\t\t\t\t", |
| 5 => "\t\t\t\t\t"); |
| |
| |
| $levels = array('/<\/?html/' => 0, |
| '/<\/?(body|head)( .+|>)/' => 1, |
| '/<\/?(title)( .+|>)/' => 2, |
| '/<\/?(br|hr) \/>/' => 2, |
| '/<\/?(p|pre|table|dl|ul|ol|div|h[1-9]|form|link)( .+|>)/' => 3, |
| '/<\/?(li|dt|dd|span|select|option|tr)( .+|>)/' => 4, |
| '/<\/?(th|td)( .+|>)/' => 5); |
| |
| |
| foreach ( $htmlblock as $line ) |
| { |
| foreach ( $levels as $tag => $level ) |
| { |
| if ( preg_match( $tag, $line ) ) |
| { |
| $html_formatted .= $tabs[$level] . $line . "\n"; |
| } |
| |
| } |
| } |
| |
| return $html_formatted; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| function format_message( $message = 'Empty', $color = '' ) |
| { |
| |
| $valid_colors = array('grey', 'green', 'orange', 'violet', 'blue', 'red'); |
| if ( ! in_array( $color, $valid_colors ) ) |
| { |
| $color = ''; |
| } |
| |
| |
| $html = '<div class="message lm ' . $color . '">' . strtoupper($message) . '</div>'; |
| |
| return $html; |
| } |
| |
| |
| |
| |
| |
| |
| function get_stepPosition() |
| { |
| |
| $steps = array(0 => 'Configuration', |
| 1 => 'Verification', |
| 2 => 'Migration', |
| 3 => 'Reset Passwords'); |
| |
| $position = isset( $_POST['step'] )?$_POST['step']:0; |
| |
| $htmlblock = array('<ul class="sublinks">'); |
| |
| foreach ( $steps as $key => $value ) |
| { |
| if ( $position == $key) |
| { |
| array_push($htmlblock,'<li class="current">'. $value.'</li>'); |
| } |
| else |
| { |
| array_push($htmlblock,'<li>'. $value.'</li>'); |
| } |
| } |
| |
| array_push( $htmlblock, '</ul>'); |
| |
| return $htmlblock; |
| } |
| |
| |
| |
| |
| function get_navibar() |
| { |
| global $db; |
| |
| $htmlblock = array('<ul class="navibar">'); |
| |
| if ( isset($_GET['p']) && $_GET['p'] == 'help' ) |
| { |
| array_push($htmlblock, '<li><a href="index.php">Main</a></li>'); |
| array_push($htmlblock, '<li class="current"><a href="?p=help">Help</a></li>'); |
| } |
| else |
| { |
| array_push($htmlblock, '<li class="current"><a href="index.php">Main</a></li>'); |
| array_push($htmlblock, '<li><a href="?p=help">Help</a></li>'); |
| } |
| |
| array_push( $htmlblock, '</ul>'); |
| |
| return $htmlblock; |
| } |
| } |
| |
| $html = new HTML; |
| ?> |