示例#1
0
 public function __construct($page)
 {
     admin_gatekeeper();
     global $CONFIG;
     $cshop = new stdClass();
     $this->controller = GLOBAL_IZAP_CURRENT_CONTROLLER;
     $this->action = 'action' . ucfirst($page[0]);
     $this->_page = $page;
     $this->url_vars = $this->_page;
     $this->page_layout = $this->page_shell = 'admin';
     $cshop->view = $this->_view = 'admin/' . implode('/', $page);
     $this->page_elements['title'] = elgg_echo("admin:{$page[0]}");
     if (count($page) > 1) {
         $this->page_elements['title'] .= ' : ' . elgg_echo('admin:' . implode(':', $page));
     }
     if (method_exists($this, $this->action)) {
         elgg_admin_add_plugin_settings_menu();
         elgg_set_context('admin');
         elgg_unregister_css('elgg');
         $url = elgg_get_simplecache_url('js', 'admin');
         elgg_register_js('elgg.admin', $url);
         elgg_load_js('elgg.admin');
         elgg_register_js('jquery.jeditable', 'vendors/jquery/jquery.jeditable.mini.js');
         elgg_load_js('jquery.jeditable');
     }
     $CONFIG->cshop = $cshop;
 }
示例#2
0
文件: start.php 项目: socialweb/PiGo
function twitter_bootswatch_init()
{
    $bootswatch_style = elgg_get_plugin_setting('bootswatch_style', 'twitter_bootswatch');
    switch ($bootswatch_style) {
        case 'amelia':
        case 'cerulean':
        case 'cosmo':
        case 'cyborg':
        case 'flatty':
        case 'journal':
        case 'readable':
        case 'simplex':
        case 'slate':
        case 'spacelab':
        case 'spruce':
        case 'superhero':
        case 'united':
            break;
        default:
            $bootswatch_style = 'cyborg';
    }
    // Unextend the default bootstrap override css
    elgg_unextend_view('css/elgg', 'twitter_bootstrap/css');
    // Extend system CSS with our own styles
    elgg_extend_view('css/elgg', 'twitter_bootswatch/css');
    // united bootstrap
    $bootstrap_css = 'mod/twitter_bootswatch/vendors/bootstrap-' . $bootswatch_style . '.min.css';
    elgg_register_css('twitter_bootswatch_css', $bootstrap_css, 5);
    //unload default bootstrap css and load new one
    elgg_unregister_css('bootstrap_css');
    if (get_context() != 'admin') {
        elgg_load_css('twitter_bootswatch_css');
    }
}
示例#3
0
function merge_css()
{
    // save 2 CSS requests
    elgg_extend_view('elgg.css', 'mrclay_combiner1.css', 400);
    elgg_extend_view('admin.css', 'mrclay_combiner1.css', 400);
    elgg_unregister_css('font-awesome');
    elgg_extend_view('elgg.css', 'mrclay_combiner2.css');
    elgg_extend_view('admin.css', 'mrclay_combiner2.css');
    elgg_unregister_css('lightbox');
}
示例#4
0
/**
 * Initialize the plugin
 * @return void
 */
function cropper_init()
{
    elgg_register_plugin_hook_handler('view_vars', 'input/file', 'cropper_file_input_view_vars_hook');
    elgg_extend_view('input/file', 'elements/input/file/cropper');
    elgg_extend_view('css/elgg', 'input/cropper.css');
    // override previously defined assets
    elgg_unregister_css('jquery.cropper');
    elgg_register_simplecache_view('js/cropper.js');
    $src = elgg_get_simplecache_url('js', 'cropper.js');
    elgg_register_js('jquery.cropper', $src);
    elgg_define_js('cropper', ['src' => $src, 'deps' => ['jquery']]);
}
示例#5
0
/**
 * Initialize the plugin
 * @return void
 */
function elgg_lightbox_init()
{
    if (!elgg_is_active_plugin('mrclay_combiner')) {
        elgg_unregister_js('lightbox');
    }
    elgg_unregister_css('lightbox');
    elgg_extend_view('elgg.css', 'colorbox.css');
    elgg_extend_view('admin.css', 'colorbox.css');
    if (version_compare(elgg_get_version(true), '2.2', '<')) {
        elgg_extend_view('elgg.js', 'elgg/lightbox.js');
        elgg_require_js('elgg/lightbox');
    }
}
示例#6
0
function importUsersPageHandler($page)
{
    admin_gatekeeper();
    elgg_admin_add_plugin_settings_menu();
    elgg_set_context('admin');
    elgg_unregister_css('elgg');
    elgg_load_js('elgg.admin');
    elgg_load_js('jquery.jeditable');
    $vars = array('page' => $page);
    $view = 'import/' . implode('/', $page);
    $title = "Import Users";
    $content = elgg_view($view);
    $body = elgg_view_layout('admin', array('content' => $content, 'title' => $title));
    echo elgg_view_page($title, $body, 'admin');
    return true;
}
示例#7
0
文件: start.php 项目: socialweb/PiGo
function sociable_init()
{
    global $CONFIG;
    if (elgg_get_context() === "admin") {
        elgg_unregister_css("twitter-bootstrap");
        elgg_unregister_css("ui-lightness");
        elgg_unregister_css("sociable");
        elgg_unregister_css("bubblegum");
        elgg_unregister_css("righteous");
        elgg_unregister_css("ubuntu");
        elgg_unregister_js("sociable");
        elgg_unregister_js("jquery-migrate");
        elgg_unregister_js("twitter-bootstrap");
    } else {
        elgg_register_css("twitter-bootstrap", $CONFIG->url . "mod/sociable/vendors/bootstrap/css/bootstrap.css");
        elgg_register_css("ui-lightness", $CONFIG->url . "mod/sociable/vendors/jquery-ui-1.10.2.custom/css/ui-lightness/jquery-ui-1.10.2.custom.min.css");
        elgg_register_css("sociable", $CONFIG->url . "mod/sociable/css/sociable.css");
        elgg_register_css("bubblegum", "http://fonts.googleapis.com/css?family=Bubblegum+Sans");
        elgg_register_css("righteous", "http://fonts.googleapis.com/css?family=Righteous");
        elgg_register_css("ubuntu", "http://fonts.googleapis.com/css?family=Ubuntu:400,300,300italic,400italic,500,500italic,700,700italic");
        elgg_register_js("sociable", $CONFIG->url . "mod/sociable/js/sociable.js");
        elgg_register_js("jquery", $CONFIG->url . "mod/sociable/vendors/jquery/jquery-1.9.1.min.js", "head", 0);
        elgg_register_js("jquery-migrate", $CONFIG->url . "mod/sociable/vendors/jquery/jquery-migrate-1.1.1.js", "head", 1);
        elgg_register_js("jquery-ui", $CONFIG->url . "mod/sociable/vendors/jquery-ui-1.10.2.custom/js/jquery-ui-1.10.2.custom.min.js", "head", 2);
        elgg_register_js("twitter-bootstrap", $CONFIG->url . "mod/sociable/vendors/bootstrap/js/bootstrap.min.js");
        elgg_load_css("ui-lightness");
        elgg_load_css("twitter-bootstrap");
        elgg_load_js("jquery-migrate");
        elgg_load_js("sociable");
        elgg_load_js("twitter-bootstrap");
        elgg_load_css("righteous");
        elgg_load_css("ubuntu");
        elgg_load_css("bubblegum");
        elgg_load_css("sociable");
        set_view_location("navigation/menu/site", elgg_get_plugins_path() . "sociable/new_views/");
        set_view_location("navigation/menu/elements/item", elgg_get_plugins_path() . "sociable/new_views/");
        set_view_location("navigation/menu/elements/section", elgg_get_plugins_path() . "sociable/new_views/");
        set_view_location("navigation/tabs", elgg_get_plugins_path() . "sociable/new_views/");
        set_view_location("navigation/menu/widget", elgg_get_plugins_path() . "sociable/new_views/");
    }
}
 * @package Elgg
 * @subpackage Core
 *
 * @uses $vars['head']        Parameters for the <head> element
 * @uses $vars['body_attrs']  Attributes of the <body> tag
 * @uses $vars['body']        The main content of the page
 * @uses $vars['sysmessages'] A 2d array of various message registers, passed from system_messages()
 */
// backward compatability support for plugins that are not using the new approach
// of routing through admin. See reportedcontent plugin for a simple example.
if (elgg_get_context() == 'admin') {
    if (get_input('handler') != 'admin') {
        elgg_deprecated_notice("admin plugins should route through 'admin'.", 1.8);
    }
    _elgg_admin_add_plugin_settings_menu();
    elgg_unregister_css('elgg');
    echo elgg_view('page/admin', $vars);
    return true;
}
// render content before head so that JavaScript and CSS can be loaded. See #4032
$messages = elgg_view('page/elements/messages', array('object' => $vars['sysmessages']));
$header = elgg_view('page/elements/header', $vars);
$content = elgg_view('page/elements/body', $vars);
$footer = elgg_view('page/elements/footer', $vars);
$body = <<<__BODY
<div class="elgg-page elgg-page-default">
\t<div class="elgg-page-messages">
\t\t{$messages}
\t</div>
__BODY;
if (elgg_is_logged_in()) {
示例#9
0
/**
 * Formats and serves out markdown files from plugins.
 *
 * URLs in format like admin_plugin_text_file/<plugin_id>/filename.ext
 *
 * The only valid files are:
 *	* README.txt
 *	* CHANGES.txt
 *	* INSTALL.txt
 *	* COPYRIGHT.txt
 *	* LICENSE.txt
 *
 * @param array $pages
 * @return bool
 * @access private
 */
function admin_markdown_page_handler($pages)
{
    admin_gatekeeper();
    elgg_set_context('admin');
    elgg_unregister_css('elgg');
    elgg_load_js('elgg.admin');
    elgg_load_js('jquery.jeditable');
    elgg_load_library('elgg:markdown');
    $plugin_id = elgg_extract(0, $pages);
    $plugin = elgg_get_plugin_from_id($plugin_id);
    $filename = elgg_extract(1, $pages);
    $error = false;
    if (!$plugin) {
        $error = elgg_echo('admin:plugins:markdown:unknown_plugin');
        $body = elgg_view_layout('admin', array('content' => $error, 'title' => $error));
        echo elgg_view_page($error, $body, 'admin');
        return true;
    }
    $text_files = $plugin->getAvailableTextFiles();
    if (!array_key_exists($filename, $text_files)) {
        $error = elgg_echo('admin:plugins:markdown:unknown_file');
    }
    $file = $text_files[$filename];
    $file_contents = file_get_contents($file);
    if (!$file_contents) {
        $error = elgg_echo('admin:plugins:markdown:unknown_file');
    }
    if ($error) {
        $title = $error;
        $body = elgg_view_layout('admin', array('content' => $error, 'title' => $title));
        echo elgg_view_page($title, $body, 'admin');
        return true;
    }
    $title = $plugin->getManifest()->getName() . ": {$filename}";
    $text = Markdown($file_contents);
    $body = elgg_view_layout('admin', array('content' => '<div class="elgg-markdown">' . $text . '</div>', 'title' => $title));
    echo elgg_view_page($title, $body, 'admin');
    return true;
}
示例#10
0
文件: admin.php 项目: elgg/elgg
/**
 * Handle admin pages.  Expects corresponding views as admin/section/subsection
 *
 * @param array $page Array of pages
 *
 * @return bool
 * @access private
 */
function _elgg_admin_page_handler($page)
{
    elgg_admin_gatekeeper();
    _elgg_admin_add_plugin_settings_menu();
    elgg_set_context('admin');
    elgg_unregister_css('elgg');
    elgg_require_js('elgg/admin');
    elgg_load_js('jquery.jeditable');
    // default to dashboard
    if (!isset($page[0]) || empty($page[0])) {
        $page = array('dashboard');
    }
    // was going to fix this in the page_handler() function but
    // it's commented to explicitly return a string if there's a trailing /
    if (empty($page[count($page) - 1])) {
        array_pop($page);
    }
    $vars = array('page' => $page);
    // special page for plugin settings since we create the form for them
    if ($page[0] == 'plugin_settings') {
        if (isset($page[1]) && (elgg_view_exists("settings/{$page[1]}/edit") || elgg_view_exists("plugins/{$page[1]}/settings"))) {
            $view = 'admin/plugin_settings';
            $plugin = elgg_get_plugin_from_id($page[1]);
            $vars['plugin'] = $plugin;
            $title = elgg_echo("admin:{$page[0]}");
        } else {
            forward('', '404');
        }
    } else {
        $view = 'admin/' . implode('/', $page);
        $title = elgg_echo("admin:{$page[0]}");
        if (count($page) > 1) {
            $title .= ' : ' . elgg_echo('admin:' . implode(':', $page));
        }
    }
    // gets content and prevents direct access to 'components' views
    if ($page[0] == 'components' || !($content = elgg_view($view, $vars))) {
        $title = elgg_echo('admin:unknown_section');
        $content = elgg_echo('admin:unknown_section');
    }
    $body = elgg_view_layout('admin', array('content' => $content, 'title' => $title));
    echo elgg_view_page($title, $body, 'admin');
    return true;
}
示例#11
0
<?php

gatekeeper();
elgg_load_css("splash");
elgg_load_js("splash");
elgg_unregister_css("rijkshuisstijl");
elgg_unregister_js("rijkshuisstijl");
if (!subsite_manager_on_subsite()) {
    forward("/");
}
$site = elgg_get_site_entity();
$user = elgg_get_logged_in_user_entity();
if ($site->isUser($user->guid)) {
    forward("/");
}
$missing_fields = subsite_manager_get_missing_subsite_profile_fields($user->getGUID());
$form_vars = array("class" => "rhs-splash js-validateForm");
$body_vars = array("subsite" => $site, "profile_fields" => $missing_fields);
if ($site->canJoin()) {
    if (empty($missing_fields) || $user->isAdmin()) {
        $url = elgg_add_action_tokens_to_url($subsite->url . "action/subsites/add_user");
        forward($url);
    } else {
        $title = elgg_echo("subsite_manager:subsites:join:missing_fields");
        $content = elgg_view_form("subsites/join/missing_fields", $form_vars, $body_vars);
    }
} else {
    switch ($site->getMembership()) {
        case Subsite::MEMBERSHIP_APPROVAL:
        case Subsite::MEMBERSHIP_DOMAIN_APPROVAL:
            $title = elgg_echo("subsite_manager:subsites:join:request");
示例#12
0
function userManagementPageHandler($page)
{
    switch ($page[0]) {
        case 'users':
            include elgg_get_plugins_path() . 'userManagement/pages/users.php';
            break;
        case 'deactivate':
            $userMgmt = new UserManagement();
            $userMgmt->getInactiveUsers();
            $userMgmt->deactivateUsers();
            break;
            //activate account form
        //activate account form
        case 'activate':
            $userMgmt = new UserManagement();
            //check if user doesnt have forces email send them to different form
            if ($userMgmt->validEmail(get_input('email'))) {
                include elgg_get_plugins_path() . 'userManagement/pages/activate.php';
            } else {
                include elgg_get_plugins_path() . 'userManagement/pages/changeEmail.php';
            }
            break;
            //activate account action
        //activate account action
        case 'activation':
            $userMgmt = new UserManagement();
            $userGuid = get_input('u');
            $code = get_input('c');
            $user = get_entity($userGuid);
            if (!$user) {
                register_error(elgg_echo('activate:error'));
                forward(REFERER);
            }
            $userMgmt->setUser($user);
            if (!$userMgmt->validateCode($code)) {
                register_error(elgg_echo('activate:error'));
                forward(REFERER);
            }
            //activate user
            if ($userMgmt->activateUser()) {
                system_message(elgg_echo('activate:success'));
                forward(REFERER);
            }
            break;
        case 'import':
            admin_gatekeeper();
            elgg_admin_add_plugin_settings_menu();
            elgg_set_context('admin');
            elgg_unregister_css('elgg');
            elgg_load_js('elgg.admin');
            elgg_load_js('jquery.jeditable');
            $vars = array('page' => $page);
            $view = 'usermanagement/' . implode('/', $page);
            $title = "Import Users";
            $content = elgg_view($view);
            $body = elgg_view_layout('admin', array('content' => $content, 'title' => $title));
            echo elgg_view_page($title, $body, 'admin');
            break;
        case 'resetPassword':
            set_input('guid', $_SESSION['userId']);
            include elgg_get_plugins_path() . "userManagement/pages/resetPassword.php";
            break;
        case 'registerEmails':
            include elgg_get_plugins_path() . "userManagement/pages/registerEmails.php";
            break;
        case 'admin':
            if ($page[1] == activate) {
                include elgg_get_plugins_path() . "userManagement/pages/admin/activate.php";
            }
            break;
        default:
            return false;
    }
    return true;
}