Example #1
0
function collaboration_pagesetup()
{
    global $CONFIG;
    if (get_context() == 'admin' && isadminloggedin()) {
        add_submenu_item('Manage external sites', $CONFIG->wwwroot . 'pg/collaboration/admin');
    }
}
function vazco_avatar_init()
{
    global $CONFIG;
    define('VAZCO_AVATAR_PATH', 'vazco_avatars');
    //set admin user ID to 2 - the default admin. TODO: do it cleaner.
    // Since we use ElggFile here, the ID has to belong to the user that is in the system all the time.
    define('VAZCO_AVATAR_ADMIN', 2);
    extend_view('profile/editicon', 'vazco_avatar/select', 601);
    extend_view('css', 'vazco_avatar/css', 601);
    register_action("vazco_avatar/upload", false, $CONFIG->pluginspath . "vazco_avatar/actions/upload.php");
    register_action("vazco_avatar/select", false, $CONFIG->pluginspath . "vazco_avatar/actions/select.php");
    register_action("vazco_avatar/delete", false, $CONFIG->pluginspath . "vazco_avatar/actions/delete.php");
    register_plugin_hook('action', 'profile/cropicon', 'vazco_avatar_cropicon', 600);
    if (isadminloggedin() && get_context() == 'admin' || get_context() == 'vazco_avatar') {
        add_submenu_item(elgg_echo('vazco_avatar:menu'), $CONFIG->wwwroot . 'pg/vazco_avatar/edit');
    }
    if (isadminloggedin() && get_context() == 'vazco_avatar') {
        add_submenu_item(elgg_echo('avatars:upload'), $CONFIG->wwwroot . 'pg/vazco_avatar/upload');
    }
    if (isloggedin()) {
        //update current user's avatar for topbar and edit icon page
        setUserIcon($_SESSION['user'], 'topbar');
        setUserIcon($_SESSION['user'], 'medium');
    }
}
Example #3
0
/**
 * Set up menu items
 *
 */
function categories_pagesetup()
{
    if (get_context() == 'admin' && isadminloggedin()) {
        global $CONFIG;
        add_submenu_item(elgg_echo('categories:settings'), $CONFIG->wwwroot . 'mod/categories/settings.php');
    }
}
function ckeditor_pagesetup()
{
    if (get_context() == 'admin' && isadminloggedin()) {
        global $CONFIG;
        add_submenu_item(elgg_echo('ckeditor:admin_title'), $CONFIG->wwwroot . 'mod/CKEditor/admin.php');
    }
}
Example #5
0
function dreamfish_admin_pagesetup()
{
    if (get_context() == 'admin' && isadminloggedin()) {
        global $CONFIG;
        add_submenu_item(elgg_echo('dreamfish_admin:admin_title'), $CONFIG->wwwroot . 'mod/dreamfish_admin/admintasks.php');
    }
}
Example #6
0
/**
 * Set up menu items
 */
function theme_editable_pagesetup()
{
    if (get_context() == 'admin' && isadminloggedin()) {
        global $CONFIG;
        add_submenu_item(elgg_echo('theme_editable:settings'), $CONFIG->wwwroot . 'mod/theme_editable/settings.php');
    }
}
/**
 * Adding the diagnostics to the admin menu
 *
 */
function diagnostics_pagesetup()
{
    if (get_context() == 'admin' && isadminloggedin()) {
        global $CONFIG;
        add_submenu_item(elgg_echo('diagnostics'), $CONFIG->wwwroot . 'pg/diagnostics/');
    }
}
Example #8
0
/**
 * Adding the reported content to the admin menu
 *
 */
function reportedcontent_pagesetup()
{
    if (get_context() == 'admin' && isadminloggedin()) {
        global $CONFIG;
        add_submenu_item(elgg_echo('reportedcontent'), $CONFIG->wwwroot . 'pg/reportedcontent/');
    }
}
Example #9
0
/**
 * Returns HTML for a blog post.
 *
 * @param int $guid of a blog entity.
 * @return string html
 */
function blog_get_page_content_read($owner_guid = NULL, $guid = NULL)
{
    $content = elgg_view('page_elements/content_header', array('context' => $context, 'type' => 'blog'));
    if ($guid) {
        $blog = get_entity($guid);
        if (!elgg_instanceof($blog, 'object', 'blog') && $blog->status == 'final') {
            $content .= elgg_echo('blog:error:post_not_found');
        } else {
            elgg_push_breadcrumb($blog->title, $blog->getURL());
            $content .= elgg_view_entity($blog, TRUE);
        }
    } else {
        $options = array('type' => 'object', 'subtype' => 'blog', 'full_view' => FALSE, 'order_by_metadata' => array('name' => 'publish_date', 'direction' => 'DESC', 'as' => 'int'));
        if ($owner_guid) {
            $options['owner_guid'] = $owner_guid;
        }
        // show all posts for admin or users looking at their own blogs
        // show only published posts for other users.
        if (!(isadminloggedin() || isloggedin() && $owner_guid == get_loggedin_userid())) {
            $options['metadata_name_value_pairs'] = array(array('name' => 'status', 'value' => 'published'), array('name' => 'publish_date', 'operand' => '<', 'value' => time()));
        }
        $content .= elgg_list_entities_from_metadata($options);
    }
    return array('content' => $content);
}
Example #10
0
function removewidget_pagesetup()
{
    global $CONFIG;
    if (get_context() == 'admin' && isadminloggedin()) {
        add_submenu_item(elgg_echo('remove_widgets'), $CONFIG->wwwroot . 'pg/removewidget/');
    }
}
/**
 * Adding the log browser to the admin menu
 *
 */
function logbrowser_pagesetup()
{
    if (get_context() == 'admin' && isadminloggedin()) {
        global $CONFIG;
        add_submenu_item(elgg_echo('logbrowser'), $CONFIG->wwwroot . 'pg/logbrowser/');
    }
}
function vazco_topbar_submenus()
{
    global $CONFIG;
    if (isadminloggedin() && get_context() == 'admin' || get_context() == 'vazco_topbar') {
        add_submenu_item(elgg_echo('vazco_topbar:menu:short'), $CONFIG->wwwroot . 'mod/vazco_topbar/edit.php');
    }
}
Example #13
0
function sw_admin_pagesetup()
{
    if (get_context() == 'admin' && isadminloggedin()) {
        global $CONFIG;
        add_submenu_item(elgg_echo('sw:title'), $CONFIG->wwwroot . 'pg/sticky_widgets/admin/edit.php', "s");
        // This will allow editing of default settings of sticky widgets
        //		add_submenu_item(elgg_echo('sw:title:defaults'), $CONFIG->wwwroot . 'pg/sticky_widgets/admin/defaults.php',"s");
    }
}
function plugin_installer_pagesetup()
{
    global $CONFIG;
    if (isadminloggedin()) {
        if (get_context() == "admin") {
            add_submenu_item(elgg_echo("plugin_installer:title"), $CONFIG->wwwroot . "mod/plugin_installer/index.php");
            // fast tool admin
            extend_view("admin/plugins", "plugin_installer/plugin_admin", 400);
        }
    }
}
/**
 * Loads an action script, if it exists, then forwards elsewhere
 *
 * @param string $action The requested action
 * @param string $forwarder Optionally, the location to forward to
 */
function action($action, $forwarder = "")
{
    global $CONFIG;
    $query = parse_url($_SERVER['REQUEST_URI']);
    if (isset($query['query'])) {
        $query = $query['query'];
        $query = rawurldecode($query);
        $query = explode('&', $query);
        if (sizeof($query) > 0) {
            foreach ($query as $queryelement) {
                $vals = explode('=', $queryelement, 2);
                if (sizeof($vals) > 1) {
                    set_input(trim($vals[0]), trim($vals[1]));
                }
            }
        }
    }
    $forwarder = str_replace($CONFIG->url, "", $forwarder);
    $forwarder = str_replace("http://", "", $forwarder);
    $forwarder = str_replace("@", "", $forwarder);
    if (substr($forwarder, 0, 1) == "/") {
        $forwarder = substr($forwarder, 1);
    }
    if (isset($CONFIG->actions[$action])) {
        if (isadminloggedin() || !$CONFIG->actions[$action]['admin']) {
            if ($CONFIG->actions[$action]['public'] || $_SESSION['id'] != -1) {
                // Trigger action event TODO: This is only called before the primary action is called. We need to rethink actions for 1.5
                $event_result = true;
                $event_result = trigger_plugin_hook('action', $action, null, $event_result);
                // Include action
                if ($event_result) {
                    /** Refs #749: We now warn if action token is missing. Later this will be replaced with action_gatekeeper() as detailed in #750 */
                    if (!validate_action_token(false)) {
                        // Display a temporary warning message - in future versions this will be a hard fail via an action gatekeeper.
                        $message = "WARNING: Action {$action} was called without an action token. It is stongly recommended that you consider doing this. Plugin authors should use 'input/form' or pass is_action=true to 'output/confirmlink' or 'output/url'.";
                        //if ((!isset($CONFIG->disable_action_token_warning)) || (!$CONFIG->disable_action_token_warning))
                        //	register_error($message);
                        error_log($message);
                    }
                    if (include $CONFIG->actions[$action]['file']) {
                    } else {
                        register_error(sprintf(elgg_echo('actionundefined'), $action));
                    }
                }
            } else {
                register_error(elgg_echo('actionloggedout'));
            }
        }
    } else {
        register_error(sprintf(elgg_echo('actionundefined'), $action));
    }
    forward($CONFIG->url . $forwarder);
}
function issuperadminloggedin()
{
    $result = false;
    if (isadminloggedin()) {
        $user = get_loggedin_user();
        if ($user->superadmin == "yes") {
            $result = true;
        } elseif ($user->admin == 1) {
            $result = true;
        }
    }
    return $result;
}
Example #17
0
/**
 * Loads an action script, if it exists, then forwards elsewhere
 *
 * @param string $action The requested action
 * @param string $forwarder Optionally, the location to forward to
 */
function action($action, $forwarder = "")
{
    global $CONFIG;
    $query = parse_url($_SERVER['REQUEST_URI']);
    if (isset($query['query'])) {
        $query = $query['query'];
        $query = rawurldecode($query);
        $query = explode('&', $query);
        if (sizeof($query) > 0) {
            foreach ($query as $queryelement) {
                $vals = explode('=', $queryelement);
                if (sizeof($vals) > 1) {
                    set_input(trim($vals[0]), trim($vals[1]));
                }
            }
        }
    }
    $forwarder = str_replace($CONFIG->url, "", $forwarder);
    $forwarder = str_replace("http://", "", $forwarder);
    $forwarder = str_replace("@", "", $forwarder);
    if (substr($forwarder, 0, 1) == "/") {
        $forwarder = substr($forwarder, 1);
    }
    if (isset($CONFIG->actions[$action])) {
        if (isadminloggedin() || !$CONFIG->actions[$action]['admin']) {
            if ($CONFIG->actions[$action]['public'] || $_SESSION['id'] != -1) {
                // Trigger action event TODO: This is only called before the primary action is called. We need to rethink actions for 1.5
                $event_result = true;
                $event_result = trigger_plugin_hook('action', $action, null, $event_result);
                //  $event_result = true;
                // Include action
                if ($event_result) {
                    if (@(include $CONFIG->actions[$action]['file'])) {
                    } else {
                        register_error(sprintf(elgg_echo('actionundefined'), $action));
                    }
                }
            } else {
                register_error(elgg_echo('actionloggedout'));
            }
        }
    } else {
        register_error(sprintf(elgg_echo('actionundefined'), $action));
    }
    forward($CONFIG->url . $forwarder);
}
/**
* Loads an action script, if it exists, then forwards elsewhere
*
* @param string $action The requested action
* @param string $forwarder Optionally, the location to forward to
*/
function action($action, $forwarder = "")
{
    global $CONFIG;
    // set GET params
    elgg_set_input_from_uri();
    // @todo REMOVE THESE ONCE #1509 IS IN PLACE.
    // Allow users to disable plugins without a token in order to
    // remove plugins that are imcompatible.
    // Installation cannot use tokens because it requires site secret to be
    // working. (#1462)
    // Login and logout are for convenience.
    $exceptions = array('systemsettings/install', 'admin/plugins/disable', 'logout', 'login');
    if (!in_array($action, $exceptions)) {
        // All actions require a token.
        action_gatekeeper();
    }
    $forwarder = str_replace($CONFIG->url, "", $forwarder);
    $forwarder = str_replace("http://", "", $forwarder);
    $forwarder = str_replace("@", "", $forwarder);
    if (substr($forwarder, 0, 1) == "/") {
        $forwarder = substr($forwarder, 1);
    }
    if (isset($CONFIG->actions[$action])) {
        if (isadminloggedin() || !$CONFIG->actions[$action]['admin']) {
            if ($CONFIG->actions[$action]['public'] || $_SESSION['id'] != -1) {
                // Trigger action event TODO: This is only called before the primary action is called. We need to rethink actions for 1.5
                $event_result = true;
                $event_result = trigger_plugin_hook('action', $action, null, $event_result);
                // Include action
                // Event_result being false doesn't produce an error -
                // since i assume this will be handled in the hook itself.
                // TODO make this better!
                if ($event_result) {
                    if (!(include $CONFIG->actions[$action]['file'])) {
                        register_error(sprintf(elgg_echo('actionundefined'), $action));
                    }
                }
            } else {
                register_error(elgg_echo('actionloggedout'));
            }
        }
    } else {
        register_error(sprintf(elgg_echo('actionundefined'), $action));
    }
    forward($CONFIG->url . $forwarder);
}
Example #19
0
function groups_from_members_submenus()
{
    global $CONFIG;
    $page_owner = page_owner_entity();
    // Submenu items for all group pages
    if ($page_owner instanceof ElggGroup && get_context() == 'groups' && get_loggedin_userid() != $page_owner->getOwner()) {
        if (isloggedin() && !isadminloggedin()) {
            $context = get_context();
            set_context('groupsfrommembers');
            if ($page_owner->canEdit()) {
                add_submenu_item(elgg_echo('groups:invite'), $CONFIG->wwwroot . "mod/groupsfrommembers/invite.php?group_guid={$page_owner->getGUID()}", '1groupsactions');
                if (!$page_owner->isPublicMembership()) {
                    add_submenu_item(elgg_echo('groups:membershiprequests'), $CONFIG->wwwroot . "mod/groups/membershipreq.php?group_guid={$page_owner->getGUID()}", '1groupsactions');
                }
            }
            set_context($context);
        }
    }
}
/**
 * Initialise the admin page.
 */
function admin_init()
{
    // Add plugin main menu option (last)
    extend_elgg_admin_page('admin/main_opt/statistics', 'admin/main');
    extend_elgg_admin_page('admin/main_opt/site', 'admin/main');
    extend_elgg_admin_page('admin/main_opt/user', 'admin/main');
    extend_elgg_admin_page('admin/main_opt/plugins', 'admin/main', 999);
    // Always last
    register_action('admin/user/ban', false, "", true);
    register_action('admin/user/unban', false, "", true);
    register_action('admin/user/delete', false, "", true);
    register_action('admin/user/resetpassword', false, "", true);
    register_action('admin/user/makeadmin', false, "", true);
    register_action('admin/user/removeadmin', false, "", true);
    // Register some actions
    register_action('admin/site/update_basic', false, "", true);
    // Register basic site admin action
    // Page handler
    register_page_handler('admin', 'admin_settings_page_handler');
    if (isadminloggedin()) {
        global $is_admin;
        $is_admin = true;
    }
}
Example #21
0
/**
 * Used at the top of a page to mark it as logged in admin or siteadmin only.
 *
 */
function admin_gatekeeper()
{
    gatekeeper();
    if (!isadminloggedin()) {
        $_SESSION['last_forward_from'] = current_page_url();
        register_error(elgg_echo('onlyadmins'));
        forward("pg/page/login");
    }
}
Example #22
0
// If all is present and correct, try to log in
$result = false;
if (!empty($username) && !empty($password)) {
    if ($user = authenticate($username, $password)) {
        $result = login($user, $persistent);
    }
}
// Set the system_message as appropriate
if ($result) {
    system_message(elgg_echo('loginok'));
    if ($_SESSION['last_forward_from']) {
        $forward_url = $_SESSION['last_forward_from'];
        $_SESSION['last_forward_from'] = "";
        forward($forward_url);
    } else {
        if (isadminloggedin() && !datalist_get('first_admin_login')) {
            system_message(elgg_echo('firstadminlogininstructions'));
            datalist_set('first_admin_login', time());
            forward('pg/admin/plugins');
        } else {
            if (get_input('returntoreferer')) {
                forward($_SERVER['HTTP_REFERER']);
            } else {
                forward("pg/dashboard/");
            }
        }
    }
} else {
    $error_msg = elgg_echo('loginerror');
    // figure out why the login failed
    if (!empty($username) && !empty($password)) {
function form_pagesetup()
{
    global $CONFIG;
    // Set up menu and content setting for logged in users
    if (isloggedin()) {
        form_set_menu_items();
        if (form_get_user_content_status()) {
            add_menu(elgg_echo('item:object:form_data'), $CONFIG->wwwroot . "pg/form/" . $_SESSION['user']->username);
            // add a view content option to user settings
            extend_elgg_settings_page('form/settings/usersettings', 'usersettings/user');
        }
    }
    $context = get_context();
    $form_id = get_input('form_id', get_input('id', 0));
    if (!$form_id && ($sid = get_input('sid', 0))) {
        $form_id = get_entity($sid)->form_id;
    }
    if ($form_id) {
        $form = get_entity($form_id);
        set_page_owner($form->getOwner());
    }
    $username = page_owner_entity()->username;
    if (get_context() == 'admin') {
        $admin_url = $CONFIG->wwwroot . 'mod/form/manage_all_forms.php';
        if ($username) {
            $admin_url .= '?username='******'form:manage_forms_title'), $admin_url);
    }
    if ($context == 'form:admin' && isadminloggedin()) {
        // add_submenu_item(elgg_echo('form:add_new_profile_form_link'),$CONFIG->wwwroot.'mod/form/manage_form.php?username='******'&profile=1', '4formactions');
        // add_submenu_item(elgg_echo('form:add_new_group_profile_form_link'),$CONFIG->wwwroot.'mod/form/manage_form.php?username='******'&profile=2', '4formactions');
        add_submenu_item(elgg_echo('form:manage_group_profile_categories_title'), $CONFIG->wwwroot . 'mod/form/manage_group_profile_categories.php?username='******'4formactions');
    }
    if (in_array($context, array('form', 'form:content', 'form:admin')) && isadminloggedin()) {
        // currently only admins get to manage forms
        if ($form_id) {
            add_submenu_item(elgg_echo('form:edit_page_link'), $CONFIG->wwwroot . 'mod/form/manage_form.php?id=' . $form_id, '1formactions');
            if ($context == 'form:admin') {
                add_submenu_item(elgg_echo('form:preview_link_text'), $CONFIG->wwwroot . 'mod/form/form.php?id=' . $form_id . '&preview=true', '1formactions');
                add_submenu_item(elgg_echo('form:public_link_text'), $CONFIG->wwwroot . 'mod/form/form.php?id=' . $form_id, '1formactions');
                add_submenu_item(elgg_echo('form:list_search_definitions_link'), $CONFIG->wwwroot . 'mod/form/list_search_definitions.php?form_id=' . $form_id, '1formactions');
                add_submenu_item(elgg_echo('form:add_new_search_definition_link_text'), $CONFIG->wwwroot . 'mod/form/manage_search_definition.php?form_id=' . $form_id, '1formactions');
                add_submenu_item(elgg_echo('form:manage_translations_link'), $CONFIG->wwwroot . 'mod/form/manage_form_translation.php?id=' . $form_id, '1formactions');
            }
        }
        add_submenu_item(elgg_echo('form:manage_forms_title'), $CONFIG->wwwroot . 'mod/form/manage_all_forms.php?username='******'3formactions');
        if ($context == 'form:admin') {
            add_submenu_item(elgg_echo('form:add_new_link'), $CONFIG->wwwroot . 'mod/form/manage_form.php?username='******'4formactions');
            add_submenu_item(elgg_echo('form:list_all_fields_link'), $CONFIG->wwwroot . 'mod/form/list_fields.php?type=all&username='******'3formactions');
            add_submenu_item(elgg_echo('form:list_orphan_fields_link'), $CONFIG->wwwroot . 'mod/form/list_fields.php?type=orphan&username='******'3formactions');
        }
    }
    if (in_array($context, array('form', 'form:content', 'form:admin')) && form_get_user_content_status()) {
        add_submenu_item(elgg_echo('form:view_all_forms'), $CONFIG->wwwroot . 'pg/form/' . $username, '2formactions');
    }
    if ($context == 'form:content' && $form_id) {
        if (isloggedin()) {
            set_page_owner($_SESSION['user']->getGUID());
        }
        if (!$form->profile) {
            if ($sid = get_input('sid', 0)) {
                $sid_bit = '&sid=' . $sid;
            } else {
                $sid_bit = '';
            }
            if (isloggedin()) {
                add_submenu_item(elgg_echo('form:add_content'), $CONFIG->wwwroot . 'mod/form/form.php?id=' . $form_id, '0formactions');
                //add_submenu_item(elgg_echo('form:view_mine'),$CONFIG->wwwroot.'mod/form/my_forms.php?id='.$form_id.'&form_view=mine'.$sid_bit,'4formactions');
                //add_submenu_item(elgg_echo('form:view_friends'),$CONFIG->wwwroot.'mod/form/my_forms.php?id='.$form_id.'&form_view=friends'.$sid_bit,'4formactions');
            }
            add_submenu_item(elgg_echo('form:view_all'), $CONFIG->wwwroot . 'mod/form/my_forms.php?id=' . $form_id . '&form_view=all' . $sid_bit, '0formactions');
            $sd_list = get_entities_from_metadata('form_id', $form_id, 'object', 'form:search_definition');
            if ($sd_list) {
                foreach ($sd_list as $sd) {
                    $sd_id = $sd->getGUID();
                    add_submenu_item(form_search_definition_t($form, $sd, 'title'), $CONFIG->wwwroot . 'mod/form/search.php?sid=' . $sd_id, '0formactions');
                }
            }
        }
    }
}
/**
 * Logs in a specified ElggUser. For standard registration, use in conjunction
 * with authenticate.
 * 
 * @see authenticate
 * @param ElggUser $user A valid Elgg user object
 * @param boolean $persistent Should this be a persistent login?
 * @return true|false Whether login was successful
 */
function login(ElggUser $user, $persistent = false)
{
    global $CONFIG;
    if ($user->isBanned()) {
        return false;
    }
    // User is banned, return false.
    if (check_rate_limit_exceeded($user->guid)) {
        return false;
    }
    // Check rate limit
    $_SESSION['user'] = $user;
    $_SESSION['guid'] = $user->getGUID();
    $_SESSION['id'] = $_SESSION['guid'];
    $_SESSION['username'] = $user->username;
    $_SESSION['name'] = $user->name;
    $code = md5($user->name . $user->username . time() . rand());
    $user->code = md5($code);
    $_SESSION['code'] = $code;
    if ($persistent) {
        setcookie("elggperm", $code, time() + 86400 * 30, "/");
    }
    if (!$user->save() || !trigger_elgg_event('login', 'user', $user)) {
        unset($_SESSION['username']);
        unset($_SESSION['name']);
        unset($_SESSION['code']);
        unset($_SESSION['guid']);
        unset($_SESSION['id']);
        unset($_SESSION['user']);
        setcookie("elggperm", "", time() - 86400 * 30, "/");
        return false;
    }
    // Users privilege has been elevated, so change the session id (help prevent session hijacking)
    session_regenerate_id();
    // Update statistics
    set_last_login($_SESSION['guid']);
    reset_login_failure_count($user->guid);
    // Reset any previous failed login attempts
    // Set admin shortcut flag if this is an admin
    if (isadminloggedin()) {
        global $is_admin;
        $is_admin = true;
    }
    return true;
}
Example #25
0
if (!$entity) {
    throw new InvalidParameterException(elgg_echo('InvalidParameterException:NoEntityFound'));
}
$metadata = get_metadata_for_entity($entity->guid);
$annotations = get_annotations($entity->guid);
$relationships = get_entity_relationships($entity->guid);
$exportable_values = $entity->getExportableValues();
?>
<div>
<h2><?php 
echo elgg_echo('Entity');
?>
</h2>
	<?php 
foreach ($entity as $k => $v) {
    if (in_array($k, $exportable_values) || isadminloggedin()) {
        ?>
			<p class="margin_none"><b><?php 
        echo $k;
        ?>
: </b><?php 
        echo strip_tags($v);
        ?>
</p>
<?php 
    }
}
?>
</div>

<?php 
$where_clause = trigger_plugin_hook("extend_where", "profile_manager_member_search", null, $where_clause);
// build query
$query = "from {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}users_entity u on e.guid = u.guid {$join} where " . $where_clause . $access_suffix;
// execute query and retrieve entities
$count = get_data_row("SELECT count(distinct e.guid) as total " . $query);
$count = $count->total;
if (!empty($order)) {
    $order = " order by " . $order;
}
$query = "SELECT " . $select . " " . $query . " " . $group_by . $order . " limit {$offset},{$limit}";
$entities = get_data($query, "entity_row_to_elggstar");
// present it
echo "<div class='contentWrapper'>";
echo "<h3 class='settings'>" . elgg_echo("profile_manager:members:searchresults:title") . "</h3>";
if ($count > 0) {
    $nav = elgg_view('profile_manager/members/pagination', array('function_name' => "navigate_members_search", 'offset' => $offset, 'count' => $count, 'limit' => $limit));
    $list = elgg_view_entity_list($entities, $count, $offset, $limit, false, false, false);
    echo "</div>";
    echo $nav;
    echo $list;
    echo $nav;
} else {
    echo elgg_echo("profile_manager:members:searchresults:noresults");
    echo "</div>";
}
if (isadminloggedin()) {
    echo "<div class='contentWrapper' id='members_search_result_query'><h3 class='settings'>" . elgg_echo("profile_manager:members:searchresults:query") . "</h3>";
    echo $query;
    echo "</div>";
}
echo "<script type='text/javascript'>setup_avatar_menu();</script>";
Example #27
0
/**
 * Page setup. Adds admin controls to the admin panel.
 *
 */
function defaultwidgets_pagesetup()
{
    if (get_context() == 'admin' && isadminloggedin()) {
        global $CONFIG;
        add_submenu_item(elgg_echo('defaultwidgets:menu:profile'), $CONFIG->wwwroot . 'pg/defaultwidgets/profile');
        add_submenu_item(elgg_echo('defaultwidgets:menu:dashboard'), $CONFIG->wwwroot . 'pg/defaultwidgets/dashboard');
    }
}
Example #28
0
    if ($valuetype == 'tags') {
        $input[$shortname] = string_to_tag_array($input[$shortname]);
    }
}
$user_guid = get_input('user_guid');
$user = NULL;
if (!$user_guid) {
    $user = $_SESSION['user'];
} else {
    $user = get_entity($user_guid);
}
$dgroup_guid = get_input('dgroup_guid');
$dgroup = new ElggGroup($dgroup_guid);
// load if present, if not create a new dgroup
$dgroup->subtype = 'dgroup';
if ($dgroup_guid && !$dgroup->canEdit() && !isadminloggedin()) {
    register_error(elgg_echo("dgroups:cantedit"));
    forward($_SERVER['HTTP_REFERER']);
    exit;
}
// Assume we can edit or this is a new dgroup
if (sizeof($input) > 0) {
    foreach ($input as $shortname => $value) {
        $dgroup->{$shortname} = $value;
    }
}
// Validate create
if (!$dgroup->name) {
    register_error(elgg_echo("dgroups:notitle"));
    forward($_SERVER['HTTP_REFERER']);
    exit;
Example #29
0
/**
 * Used at the top of a page to mark it as logged in admin or siteadmin only.
 *
 */
function admin_gatekeeper()
{
    gatekeeper();
    if (!isadminloggedin()) {
        $_SESSION['last_forward_from'] = current_page_url();
        forward();
    }
}
Example #30
0
/**
 * Used at the top of a page to mark it as logged in admin or siteadmin only.
 *
 */
function admin_gatekeeper()
{
    gatekeeper();
    if (!isadminloggedin()) {
        $_SESSION['last_forward_from'] = current_page_url();
        register_error(elgg_echo('adminrequired'));
        forward();
    }
}