function elggadmin_render_output($controller) { $before_render = $controller[0] . '_before'; run2($before_render, $controller); //before render templates_page_setup(); //print_object($controller); //run func, must return page object $result = run2($controller[0], $controller[1]); //take only the output of controller $page = $result[$controller[0]]; if (!isset($page->title) || !isset($page->body)) { trigger_error(__FUNCTION__ . ": returned page title or body not defined", E_USER_WARNING); } templates_page_output($page->title, $page->body); }
$do_init .= 'new YAHOO.example.DDList("eli_' . $widget->ident . '");' . "\n"; //$do_init .= 'YAHOO.util.DDM.getElement("eli_'.$widget->ident.'").did='.$widget->display_order.';'."\n"; $do_init .= 'YAHOO.util.DDM.getElement("eli_' . $widget->ident . '").column=0;' . "\n"; } } $second_column_list = ''; if ($widgets = widget_for_user($page_owner, 'profile', 0, 1)) { foreach ($widgets as $widget) { $name = 'Unknown'; $description = ''; foreach ($CFG->widgets->list as $widget_class) { if ($widget_class['type'] == $widget->type) { $name = $widget_class['name']; $description = $widget_class['description']; break; } } $second_column_list .= sprintf($column_list_element_template, $description, $description, $widget->ident, $name); $do_init .= 'new YAHOO.example.DDList("eli_' . $widget->ident . '");' . "\n"; //$do_init .= 'YAHOO.util.DDM.getElement("eli_'.$widget->ident.'").did='.$widget->display_order.';'."\n"; $do_init .= 'YAHOO.util.DDM.getElement("eli_' . $widget->ident . '").column=1;' . "\n"; } } $title = __gettext("Manage Widgets"); $body = sprintf($top_bit_template, $do_init) . sprintf($widget_template, $widget_list, $first_column_list, $second_column_list); } else { $body = __gettext("You must be logged-in to manage your widgets"); } // Output to the screen templates_page_output($title, $body);
// Draw the user's comment wall if (function_exists("commentwall_displayonprofile")) { $offset = optional_param('offset', 0); $limit = optional_param('limit', 3); $run_result .= commentwall_displayonprofile($page_owner, $limit, $offset); } $view = array(); $view['body'] = $run_result; $run_result = ''; $username = user_info('username', $this->id); $run_result .= '<div id="profile_widgets">' . "\n"; $run_result .= widget_page_display($page_owner, 'profile', 0, 2); $run_result .= "</div>\n"; $view['body'] .= $run_result; return $view; } } //Pruebas con el perfil extendido // init library $profileall = new ElggProfile($profile_id); //$title = user_name($profile_id); //$profile->display_name(); $body = $profileall->view(); $run_result .= $body; // init library $profile = new ElggProfile2($profile_id); $title = $profile->display_name(); // $title = 'Profile'; $view = $profile->view(); $run_result .= $view['body']; templates_page_output($title, $run_result);
/** * Request confirmation to perform some action * * @param string $message Message to show on request * @param mixed $vars array of parameters to re-send needed to continue action * @return bool true if sucessful confirmed */ function require_confirm($message, $vars = null) { global $CFG; $form_key = optional_param('form_key'); // check if pass key verification if (elggform_key_check($form_key, 'confirm')) { // pass form key verification return true; } else { // build form key and show form $form_key = elggform_key_get('confirm'); $title = __gettext('Please confirm your action'); $sContinue = __gettext('Continue'); $or = __gettext('or'); $sBack = __gettext('Back'); // add form key $vars['form_key'] = $form_key; // add parameters $inputs = ''; foreach ($vars as $name => $value) { $value = htmlspecialchars($value, ENT_COMPAT, 'utf-8'); // prevent messing code $inputs .= "<input type=\"hidden\" id=\"{$name}\" name=\"{$name}\" value=\"{$value}\" />\n"; } // add buttons //$inputs .= "<input type=\"button\" value=\"{$sBack}\" onclick=\"history.back()\" />\n"; $inputs .= "<a href=\"#\" onclick=\"history.back(); return false;\">{$sBack}</a> {$or} "; $inputs .= "<input type=\"submit\" name=\"submit\" value=\"{$sContinue}\" />\n"; $body = "<div id=\"confirm-form\">\n"; $body .= "<form name=\"confirm-form\" action=\"\" method=\"post\">\n"; $body .= templates_draw(array('context' => 'databox', 'name' => $message, 'column1' => $inputs)); $body .= "</form>\n"; $body .= "</div>\n"; // show form templates_page_output($title, $body); } return false; }
if (page_owner() > 0) { define('context', 'pages'); } // pages init pages_actions(); templates_page_setup(); if (page_owner() < 1) { // remove all but pages block sidebar_remove(array('pages_sidebar'), true); } $page_id = optional_param('page'); $do_action = optional_param('do'); if (!pages_enabled()) { $page = new StdClass(); $page->title = __gettext('Plugin disabled for users'); $page->content = __gettext('This plugin is currently disabled by site administrator'); } else { if ($do_action == 'edit') { $page = pages_edit_page($page_id, page_owner()); } else { $page = pages_get_page($page_id, page_owner()); } } if (!empty($page->ident)) { // link title $title = pages_html_a(get_url($page_id, 'pages::page', page_owner()), $page->title); } else { $title = $page->title; } templates_page_output($title, $page->content);
} $l = optional_param('username'); $p = optional_param('password'); if (!empty($l) && !empty($p)) { $ok = authenticate_account($l, $p); if ($ok) { //$messages[] = __gettext("You have been logged on."); if (md5($p) == md5("password")) { $messages[] = __gettext("The password for this account is extremely insecure and represents a major security risk. You should change it immediately."); } if (strpos($redirect_url, 'register') > 0 || strpos($redirect_url, "login") > 0 || strpos($redirect_url, 'password')) { $redirect_url = $CFG->wwwroot . $_SESSION['username'] . "/"; } define('redirect_url', $redirect_url); $_SESSION['messages'] = $messages; header("Location: " . redirect_url); exit; } else { $messages[] = __gettext("Unrecognised username or password. The system could not log you on, or you may not have activated your account."); } } else { if (!empty($l) || !empty($p)) { // if ONLY one was entered, make the error message. $messages[] = __gettext("Either the username or password were not specified. The system could not log you on."); } } $body = __gettext('Please log in'); templates_page_setup(); // display the form. templates_page_output(__gettext('Log On'), $body);
$l = optional_param('username'); $p = optional_param('password'); if (!empty($l) && !empty($p)) { $ok = authenticate_account($l, $p); if ($ok) { //$messages[] = __gettext("You have been logged on. =P"); if (md5($p) == md5("password")) { $messages[] = __gettext("The password for this account is extremely insecure and represents a major security risk. You should change it immediately."); } // override with redirect_url in session if (isset($_SESSION['redirect_url'])) { define('redirect_url', $_SESSION['redirect_url']); unset($_SESSION['redirect_url']); } else { define('redirect_url', $redirect_url); } header_redirect(redirect_url); } else { $messages[] = __gettext("Unrecognised username or password. The system could not log you on, or you may not have activated your account."); } } else { if (!empty($l) || !empty($p)) { // if ONLY one was entered, make the error message. $messages[] = __gettext("Either the username or password were not specified. The system could not log you on."); } } $body = __gettext('Please log in'); templates_page_setup(); // display the form. templates_page_output($CFG->sitename, $body);
<?php /** Index page */ // Load the Elgg framework require_once "../../includes.php"; global $CFG, $messages; /* * Variable initialisation */ $owner = page_owner(); if (empty($owner)) { $owner = -1; } global $page_owner; $page_owner = $owner; $offset = optional_param('offset', 0); $limit = optional_param('limit', 10); $title = sprintf(__gettext("%s's Comment Wall"), user_info("name", $owner)); $wall = commentwall_getwall($owner, $limit, $offset); $html = commentwall_displaywall_html($wall, true, $owner); $html .= commentwall_display_footer($owner, $limit, $offset); templates_page_output($title, $html);
<?php // ELGG template create / select page // Run includes require_once dirname(dirname(__FILE__)) . "/../includes.php"; require_login(); run("profile:init"); run("templates:init"); $title = __gettext("Template Preview"); define("context", "account"); templates_page_setup(); $body = templates_preview(); global $messages; $messages[] = "System message 1"; $messages[] = "System message 2"; templates_page_output($title, $body, false);
<?php global $CFG; define('context', 'external'); require_once dirname(__FILE__) . "/includes.php"; $context = isloggedin() ? 'frontpage_loggedin' : 'frontpage_loggedout'; $title = $CFG->sitename; templates_page_setup(); templates_page_output($title, null, $context);