Example #1
0
File: Page.php Project: broozer/psa
 public function __destruct()
 {
     try {
         if (!self::$html_set || !self::$head_set) {
             throw new PageException("<b>HTML class exception.</b><br />Either &lt;html&gt; or &lt;head&gt; or &lt;body&gt; is not set.</b><br />\n\t\t\t\t\tAll these tags need to be used in order to generate valid html forms.");
         }
         self::$output .= "</body>\n</html>";
         if (self::$debug) {
             echo '<b>Tidy messages</b><br />';
             $tidy = tidy_parse_string(self::$output);
             echo nl2br(htmlentities(tidy_get_error_buffer($tidy)));
             echo '<hr />';
             $linedump = explode("\n", nl2br(htmlentities(str_replace("<br />", "\n", self::$output))));
             // var_dump($linedump);
             for ($i = 0; $i < sizeof($linedump); ++$i) {
                 if (trim(str_replace("<br>", "", $linedump[$i])) == '') {
                     continue;
                 }
                 $il = strlen($i);
                 $il4 = 4 - $il;
                 $j = $i + 1;
                 $linenr = str_repeat("&nbsp;", $il4) . $j;
                 echo $linenr . ' : ' . $linedump[$i];
             }
             echo '<hr />';
             self::$output = '';
         } else {
             echo self::$output;
             self::$output = '';
         }
     } catch (PageException $e) {
         echo $e->getMessage();
     }
 }
Example #2
0
function error($error_msg = 'There was an error processing the request.', $file = 'NONE', $error_base = './')
{
    global $template, $language, $enable_rss, $lang, $charset, $default_path;
    if (!isset($template)) {
        $template = 'default';
    }
    if (!isset($lang['l_powered_by'])) {
        $lang['l_powered_by'] = 'Powered by';
    }
    if (!isset($lang['l_error_title'])) {
        $lang['l_error_title'] = 'Error!';
    }
    if (!isset($lang['l_error_window'])) {
        $lang['l_error_window'] = 'There was an error!';
    }
    if (!isset($lang['l_error_calendar'])) {
        $lang['l_error_calendar'] = 'The calendar "%s" was being processed when this error occurred.';
    }
    if (!isset($lang['l_error_back'])) {
        $lang['l_error_back'] = 'Please use the "Back" button to return.';
    }
    if (!isset($lang['l_this_site_is'])) {
        $lang['l_this_site_is'] = 'This site is';
    }
    if (!isset($enable_rss)) {
        $enable_rss = 'no';
    }
    $error_calendar = sprintf($lang['l_error_calendar'], $file);
    $current_view = 'error';
    $display_date = $lang['l_error_title'];
    $calendar_name = $lang['l_error_title'];
    if (empty($default_path)) {
        if (isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'on') {
            $default_path = 'https://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], '/rss/'));
        } else {
            $default_path = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], '/rss/'));
        }
    }
    $page = new Page(BASE . 'templates/' . $template . '/error.tpl');
    $page->replace_files(array('header' => BASE . 'templates/' . $template . '/header.tpl', 'footer' => BASE . 'templates/' . $template . '/footer.tpl'));
    $page->replace_tags(array('version' => $phpicalendar_version, 'default_path' => $default_path . '/', 'template' => $template, 'cal' => $cal, 'getdate' => $getdate, 'charset' => $charset, 'calendar_name' => $calendar_name, 'display_date' => $display_date, 'rss_powered' => $rss_powered, 'rss_available' => '', 'event_js' => '', 'todo_js' => '', 'todo_available' => '', 'rss_valid' => '', 'error_msg' => $error_msg, 'error_calendar' => $error_calendar, 'generated' => $generated, 'l_powered_by' => $lang['l_powered_by'], 'l_error_back' => $lang['l_error_back'], 'l_error_window' => $lang['l_error_window']));
    $page->output();
}
Example #3
0
function error($error_msg = 'There was an error processing the request.', $file = 'NONE', $error_base = '')
{
    global $getdate, $rss_powered, $lang, $phpiCal_config, $cal;
    if (!isset($template)) {
        $template = $phpiCal_config->template;
    }
    $error_calendar = sprintf($lang['l_error_calendar'], print_r($file, true));
    $current_view = 'error';
    $display_date = $lang['l_error_title'];
    $calendar_name = $lang['l_error_title'];
    $default_path = $phpiCal_config->default_path;
    if (empty($phpiCal_config->default_path)) {
        if (isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'on') {
            $default_path = 'https://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], '/rss/'));
        } else {
            $default_path = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], '/rss/'));
        }
    }
    $page = new Page(BASE . 'templates/' . $template . '/error.tpl');
    $page->replace_files(array('header' => BASE . 'templates/' . $template . '/header.tpl', 'footer' => BASE . 'templates/' . $template . '/footer.tpl'));
    $page->replace_tags(array('version' => $phpiCal_config->phpicalendar_version, 'default_path' => $phpiCal_config->default_path . $error_base, 'template' => $template, 'cal' => $cal, 'getdate' => $getdate, 'charset' => $phpiCal_config->charset, 'calendar_name' => $calendar_name, 'display_date' => $display_date, 'rss_powered' => $rss_powered, 'rss_available' => '', 'event_js' => '', 'todo_js' => '', 'todo_available' => '', 'rss_valid' => '', 'error_msg' => $error_msg, 'error_calendar' => $error_calendar, 'l_powered_by' => $lang['l_powered_by'], 'l_error_back' => $lang['l_error_back'], 'l_error_window' => $lang['l_error_window'], 'l_this_site_is' => $lang['l_this_site_is']));
    $page->output();
}
Example #4
0
}
if ($event['url'] != '') {
    $event['url'] = '<a href="' . $event['url'] . '" target="_blank">' . $event['url'] . '</a>';
}
switch ($event['status']) {
    case 'CONFIRMED':
        $event['status'] = $lang['l_status_confirmed'];
        break;
    case 'CANCELLED':
        $event['status'] = $lang['l_status_cancelled'];
        break;
    case 'TENTATIVE':
        $event['status'] = $lang['l_status_tentative'];
        break;
    default:
        $event['status'] = '';
}
$event_download = '';
if ($phpiCal_config->event_download == 'yes') {
    $event_download = "\n<form action='' method='post'>\n<input type=hidden name='event_data' value = '" . $_POST['event_data'] . "' />\n<input type=hidden name='uid' value = '" . $_POST['uid'] . "' />\n<input type='submit' name='submit' value='" . $lang['l_download_event'] . "' />\n<form>";
}
if (isset($_POST['submit'])) {
    header("Content-Type: text/calendar; charset=utf-8; name={$uid}");
    header("Content-Disposition: attachment; filename={$uid}");
    echo "BEGIN:VCALENDAR\nVERSION:2.0\nX-WR-CALNAME:" . $event['calname'] . "\nBEGIN:VEVENT\nUID:{$uid}\nSUMMARY:" . $event['event_text'] . "\nCATEGORIES:" . $event['calname'] . "\nDTSTART;TZID=" . $event['timezone'] . ":" . date("Ymd\\THis", $event['start_unixtime']) . "\nDTEND;TZID=" . $event['timezone'] . ":" . date("Ymd\\THis", $event['start_unixtime']) . "\nCLASS:" . $event['class'] . "\n" . $event['other'] . "\nSEQUENCE:1\nCREATED:20081128T075152\nEND:VEVENT\nEND:VCALENDAR\n";
    exit;
}
$page = new Page(BASE . 'templates/' . $phpiCal_config->template . '/event.tpl');
$page->replace_tags(array('charset' => $phpiCal_config->charset, 'cal' => $event['calname'], 'event_text' => $event['event_text'], 'event_times' => $event_times, 'description' => $event['description'], 'organizer' => $organizer, 'attendee' => $attendee, 'status' => $event['status'], 'location' => $event['location'], 'event_download' => $event_download, 'url' => $event['url'], 'cal_title_full' => $event['calname'], 'template' => $phpiCal_config->template, 'l_summary' => $lang['l_summary'], 'l_description' => $lang['l_description'], 'l_organizer' => $lang['l_organizer'], 'l_attendee' => $lang['l_attendee'], 'l_status' => $lang['l_status'], 'l_location' => $lang['l_location'], 'l_url' => $lang['l_url']));
$page->output();
Example #5
0
    echo ucfirst($_GET['p']);
}
?>
</title>
<?php 
$content = new Page('styles/' . $template['path'] . '/template.html');
$content->loadCustoms();
$content->replace_tags(array('content' => 'modules/content.php'));
$content->replace_tags(array('menu' => 'modules/menu.php'));
$content->replace_tags(array('login' => 'modules/login.php'));
$content->replace_tags(array('account' => 'modules/account.php'));
$content->replace_tags(array('serverstatus' => 'modules/server_status.php'));
$content->replace_tags(array('slideshow' => 'modules/slideshow.php'));
$content->replace_tags(array('footer' => 'modules/footer.php'));
$content->replace_tags(array('loadjava' => 'includes/javascript_loader.php'));
$content->replace_tags(array('social' => 'modules/social.php'));
$content->replace_tags(array('alert' => 'modules/alert.php'));
?>
</head>
<body>
<?php 
$dirname = "install/";
if (!is_dir($dirname)) {
    $content->output();
} else {
    echo "<center><h1>The install directory still exists<br>please remove it to view your site.</h2>";
}
?>
 
</body>
</html>
Example #6
0
<?
ob_start();
require_once( "resources/bin/constants.php");
add_required_class( 'Page.Class.php', MODEL );
//$application = new ApplicationSettings( "MedTeleNursing.AppSettings", ENVIRONMENT);
$pageName = $_REQUEST[ 'page' ];
if($application->isPageGated($pageName)){
	if(!$application->session->isSessionAuthenticated()){
		$application->enforceGate();
	}
}
$page = new Page( $pageName );
$page->process();
echo htmlspecialchars_decode( $page->output() );
echo ob_get_clean();
?>