{ $user = get_login_user(); switch ($module) { case 'EventCalendarModule': $obj->assoc_type = 'user'; $obj->assoc_id = (int) $_SESSION['user']['id']; $obj->may_edit = true; // user may edit own events, right? ;) $obj->assoc_title = $user->login_name; break; } $obj->mode = PUB; } $page = new PageRenderer("setup_module", PAGE_CALENDAR, "Calendar - PeopleAggregator", "container_one_column.tpl", "header_user.tpl", NULL, PRI, $network_info); $theme_details = get_user_theme($login_uid); if (is_array($theme_details['css_files'])) { foreach ($theme_details['css_files'] as $key => $value) { $page->add_header_css($value); } } $css_path = $current_theme_path . '/calendar.css'; $page->add_header_css($css_path); $page->add_header_html(js_includes('calendar.js')); if (!empty($msg)) { $msg_tpl =& new Template(CURRENT_THEME_FSPATH . "/display_message.tpl"); $msg_tpl->set('message', $msg); $page->add_module("middle", "top", $msg_tpl->fetch()); } $page->add_header_html($parameter); // uihelper_get_group_style($gid); echo $page->render();
} } function setup_module($column, $module, $obj) { global $preview_msg; switch ($module) { case 'NetworkBulletinsModule': $obj->preview_msg = $preview_msg; break; } } $page = new PageRenderer("setup_module", PAGE_NETWORK_BULLETINS, "Network Bulletins", 'container_two_column.tpl', 'header.tpl', PRI, HOMEPAGE, PA::$network_info); if (!empty($error_msg)) { $msg_tpl = new Template(CURRENT_THEME_FSPATH . "/display_message.tpl"); $msg_tpl->set('message', $error_msg); $m = $msg_tpl->fetch(); $page->add_module("middle", "top", $m); } $page->html_body_attributes = 'class="no_second_tier network_config"'; $css_array = get_network_css(); if (is_array($css_array)) { foreach ($css_array as $key => $value) { $page->add_header_css($value); } } $css_data = inline_css_style(); if (!empty($css_data['newcss']['value'])) { $css_data = '<style type="text/css">' . $css_data['newcss']['value'] . '</style>'; $page->add_header_html($css_data); } echo $page->render();
// --- left sidebar (debugging) function render_debug_sidebar() { global $user; ob_start(); echo "<p>badges: "; var_dump($user->list_widgets()); echo "</p>"; try { $default_badge = $user->load_widget("default"); echo "<p>default badge: "; var_dump($default_badge); echo "</p>"; } catch (PAException $e) { echo "<p>no default badge available.</p>"; } $debug_sidebar = ob_get_contents(); ob_end_clean(); return $debug_sidebar; } // --- $page = new PageRenderer(NULL, PAGE_BADGE_CREATE, sprintf(__("%s - My Widgets - %s"), $login_user->get_name(), PA::$network_info->name), "container_three_column.tpl", 'header_user.tpl'); $page->onload = "badge.update();"; $page->add_header_css(PA::$theme_url . "/badge_create.css"); $page->add_module("left", "top", render_left_sidebar()); //$page->add_module("left", "top", render_debug_sidebar()); // debugging $page->add_module("middle", "top", $page_html); $page->add_module("right", "top", render_right_sidebar()); uihelper_set_user_heading($page); echo $page->render(); ?>
{$your_permissions} <p>{$paging}</p> <table class="bulk_comment_summary"><tr> <td>ID</td> <td>Post</td> <td>Name</td> <td>Email</td> <td>Website</td> <td>Subject</td> <td>Comment</td> <td>IP</td> <td>X</td> </tr> {$comments} </table> </div><!-- comment_manage_pane --> EOS; return $page_html; } // --- $user = new User(); $user->load($login_uid); $page = new PageRenderer(NULL, PAGE_COMMENT_MANAGEMENT, "Manage comments", "container_one_column.tpl", "header.tpl"); $page->add_header_js("fat.js"); $page->add_header_css(PA::$theme_url . "/comment_management.css"); $page->add_module("middle", "top", render_main_page_area($user)); uihelper_set_user_heading($page); echo $page->render();
<?php $login_required = FALSE; include "includes/page.php"; $code_esc = intval(@$_REQUEST['code']); $msg_esc = htmlspecialchars(@$_REQUEST['msg']); // --- $page = new PageRenderer(NULL, NULL, "Error {$code_esc}: {$msg_esc}", "generic_error.tpl", 'header.tpl', PRI, HOMEPAGE, $network_info); $msg_tpl =& new Template(CURRENT_THEME_FSPATH . "/error_middle.tpl"); $msg_tpl->set('code', $code_esc); $msg_tpl->set('msg', $msg_esc); $page->add_module("middle", "top", $msg_tpl->fetch()); $page->add_module("middle", "bottom", '<p style="text-align: center"><a href="' . htmlspecialchars($_SERVER['HTTP_REFERER']) . '">back</a></p>'); echo $page->render();
function exception_handler($exception) { global $current_theme_path; // clean out any buffering so we can write straight to the client while (@ob_end_clean()) { } try { while ($exception->getCode() == 100 && strpos($exception->getMessage(), "no such table") != -1) { // See if the database hasn't been populated. // (Note: we use 'while' here rather than 'if' so we can use break // to avoid this turning into a mess of nested blocks). // First, make sure we have a working database connection. try { $sth = Dal::query("SHOW TABLES"); } catch (PAException $e) { // The database connection isn't working - so fall through to // the normal error handler. break; } // Now run through the results and see if we can find a familiar // table. $found = 0; while ($r = $sth->fetchRow()) { if ($r[0] == "page_settings") { $found = 1; break; } } if ($found) { // ok, the db *has* been populated - fall through break; } // If we get this far, it means that the DB isn't populated, so we // show a message to the user (who is presumably an admin, // installing the system). global $path_prefix; ?> <h1>Database not populated</h1> <p>Before you can run PeopleAggregator, you need to populate the database by running the script <code><?php echo $path_prefix; ?> /db/PeepAgg.mysql</code> on your database. You can do it in the MySQL console like this:</p> <pre><i>user</i>@<i>server</i>:<?php echo $path_prefix; ?> $ <b>mysql -u <i>username</i> -p</b> Enter password: <b><i>password</i></b> Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 63048 to server version: 4.1.14-Debian_6-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> <b>use paalpha</b> Database changed mysql> <b>source <?php echo $path_prefix; ?> /db/PeepAgg.mysql</b></pre> <?php exit; } // render an error message $code_esc = intval($exception->getCode()); $msg_esc = htmlspecialchars($exception->getMessage()); $page = new PageRenderer(NULL, NULL, "Error {$code_esc}: {$msg_esc}", "container_one_column.tpl"); $msg_tpl =& new Template(CURRENT_THEME_FSPATH . "/error_middle.tpl"); $msg_tpl->set('code', $code_esc); $msg_tpl->set('msg', $msg_esc); $page->add_module("middle", "top", $msg_tpl->fetch()); $css_path = $current_theme_path . '/layout.css'; $page->add_header_css($css_path); $css_path = $current_theme_path . '/network_skin.css'; $page->add_header_css($css_path); $page->header->set('navigation_links', null); //setting the links to null echo $page->render(); // write a copy into the log Logger::log("An exception occurred: code " . $exception->getCode() . ", message " . $exception->getMessage() . "\n" . $exception->getTraceAsString(), LOGGER_ERROR); } catch (Exception $e) { // If an error occurred in PageRenderer or something, present a much plainer screen with both errors: echo "<h1>Lots of errors occurred!</h1>\n<p>An error occurred, then the error handler crashed while trying to handle the error. Whoops!</p>\n<p><b>Here are the details of the original error:</b></p>\n<p>" . $exception->getMessage() . "</p>\n<pre>" . $exception->getTraceAsString() . "</pre>\n<p><b>Here are the details of the second error:</b></p>\n<p>" . $e->getMessage() . "</p>\n<pre>" . $e->getTraceAsString() . "</pre>"; } exit; }