From 96e403d69956434aadd588fcfb08fb6f0a329d9c Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 1 Jan 2012 15:29:39 -0500 Subject: Fixes #4168 ignoring access when saving an admin notice --- engine/lib/admin.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'engine/lib/admin.php') diff --git a/engine/lib/admin.php b/engine/lib/admin.php index a191d740b..1f085eee4 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -79,6 +79,10 @@ function elgg_add_admin_notice($id, $message) { if (elgg_admin_notice_exists($id)) { return false; } + + // need to handle when no one is logged in + $old_ia = elgg_set_ignore_access(true); + $admin_notice = new ElggObject(); $admin_notice->subtype = 'admin_notice'; // admins can see ACCESS_PRIVATE but no one else can. @@ -86,13 +90,16 @@ function elgg_add_admin_notice($id, $message) { $admin_notice->admin_notice_id = $id; $admin_notice->description = $message; - return $admin_notice->save(); + $result = $admin_notice->save(); + + elgg_set_ignore_access($old_ia); + + return (bool)$result; } - return FALSE; + return false; } - /** * Remove an admin notice by ID. * -- cgit v1.2.3 From a5d89ccf653748c471a3c62c46a02db3be4e23dc Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Mon, 2 Jan 2012 09:13:37 -0500 Subject: Fixes #4164 adds a server statistics page to admin area --- engine/lib/admin.php | 1 + languages/en.php | 12 +++++++ views/default/admin/statistics/basic.php | 19 ---------- views/default/admin/statistics/numentities.php | 40 ---------------------- views/default/admin/statistics/overview.php | 4 +-- views/default/admin/statistics/overview/basic.php | 19 ++++++++++ .../admin/statistics/overview/numentities.php | 40 ++++++++++++++++++++++ views/default/admin/statistics/server.php | 8 +++++ views/default/admin/statistics/server/php.php | 33 ++++++++++++++++++ .../default/admin/statistics/server/web_server.php | 16 +++++++++ 10 files changed, 131 insertions(+), 61 deletions(-) delete mode 100644 views/default/admin/statistics/basic.php delete mode 100644 views/default/admin/statistics/numentities.php create mode 100644 views/default/admin/statistics/overview/basic.php create mode 100644 views/default/admin/statistics/overview/numentities.php create mode 100644 views/default/admin/statistics/server.php create mode 100644 views/default/admin/statistics/server/php.php create mode 100644 views/default/admin/statistics/server/web_server.php (limited to 'engine/lib/admin.php') diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 1f085eee4..5a475a9f0 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -262,6 +262,7 @@ function admin_init() { // statistics elgg_register_admin_menu_item('administer', 'statistics', null, 20); elgg_register_admin_menu_item('administer', 'overview', 'statistics'); + elgg_register_admin_menu_item('administer', 'server', 'statistics'); // users elgg_register_admin_menu_item('administer', 'users', null, 20); diff --git a/languages/en.php b/languages/en.php index acc8e0bc0..d9149a689 100644 --- a/languages/en.php +++ b/languages/en.php @@ -568,6 +568,7 @@ $english = array( 'admin:statistics' => "Statistics", 'admin:statistics:overview' => 'Overview', + 'admin:statistics:server' => 'Server Info', 'admin:appearance' => 'Appearance', 'admin:administer_utilities' => 'Utilities', @@ -726,6 +727,17 @@ $english = array( 'admin:statistics:label:version:release' => "Release", 'admin:statistics:label:version:version' => "Version", + 'admin:server:label:php' => 'PHP', + 'admin:server:label:web_server' => 'Web Server', + 'admin:server:label:server' => 'Server', + 'admin:server:label:log_location' => 'Log Location', + 'admin:server:label:php_version' => 'PHP version', + 'admin:server:label:php_ini' => 'PHP ini file location', + 'admin:server:label:php_log' => 'PHP Log', + 'admin:server:label:mem_avail' => 'Memory available', + 'admin:server:label:mem_used' => 'Memory used', + 'admin:server:error_log' => "Web server's error log", + 'admin:user:label:search' => "Find users:", 'admin:user:label:searchbutton' => "Search", diff --git a/views/default/admin/statistics/basic.php b/views/default/admin/statistics/basic.php deleted file mode 100644 index 2c9b3b88e..000000000 --- a/views/default/admin/statistics/basic.php +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - -
: - , -
: /
\ No newline at end of file diff --git a/views/default/admin/statistics/numentities.php b/views/default/admin/statistics/numentities.php deleted file mode 100644 index af4ae2773..000000000 --- a/views/default/admin/statistics/numentities.php +++ /dev/null @@ -1,40 +0,0 @@ - - - $entry) { - arsort($entry); - foreach ($entry as $a => $b) { - - //This function controls the alternating class - $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; - - if ($a == "__base__") { - $a = elgg_echo("item:{$k}"); - if (empty($a)) - $a = $k; - } else { - if (empty($a)) { - $a = elgg_echo("item:{$k}"); - } else { - $a = elgg_echo("item:{$k}:{$a}"); - } - - if (empty($a)) { - $a = "$k $a"; - } - } - - echo <<< END - - - - -END; - } - } -?> -
{$a}:{$b}
diff --git a/views/default/admin/statistics/overview.php b/views/default/admin/statistics/overview.php index 2f5b25121..ac5aaac36 100644 --- a/views/default/admin/statistics/overview.php +++ b/views/default/admin/statistics/overview.php @@ -8,6 +8,6 @@ echo elgg_view('admin/statistics/extend'); -echo elgg_view_module('inline', elgg_echo('admin:statistics:label:basic'), elgg_view('admin/statistics/basic')); +echo elgg_view_module('inline', elgg_echo('admin:statistics:label:basic'), elgg_view('admin/statistics/overview/basic')); -echo elgg_view_module('inline', elgg_echo('admin:statistics:label:numentities'), elgg_view('admin/statistics/numentities')); \ No newline at end of file +echo elgg_view_module('inline', elgg_echo('admin:statistics:label:numentities'), elgg_view('admin/statistics/overview/numentities')); diff --git a/views/default/admin/statistics/overview/basic.php b/views/default/admin/statistics/overview/basic.php new file mode 100644 index 000000000..2c9b3b88e --- /dev/null +++ b/views/default/admin/statistics/overview/basic.php @@ -0,0 +1,19 @@ + + + + + + + + + + +
: - , -
: /
\ No newline at end of file diff --git a/views/default/admin/statistics/overview/numentities.php b/views/default/admin/statistics/overview/numentities.php new file mode 100644 index 000000000..af4ae2773 --- /dev/null +++ b/views/default/admin/statistics/overview/numentities.php @@ -0,0 +1,40 @@ + + + $entry) { + arsort($entry); + foreach ($entry as $a => $b) { + + //This function controls the alternating class + $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; + + if ($a == "__base__") { + $a = elgg_echo("item:{$k}"); + if (empty($a)) + $a = $k; + } else { + if (empty($a)) { + $a = elgg_echo("item:{$k}"); + } else { + $a = elgg_echo("item:{$k}:{$a}"); + } + + if (empty($a)) { + $a = "$k $a"; + } + } + + echo <<< END + + + + +END; + } + } +?> +
{$a}:{$b}
diff --git a/views/default/admin/statistics/server.php b/views/default/admin/statistics/server.php new file mode 100644 index 000000000..9d21addc1 --- /dev/null +++ b/views/default/admin/statistics/server.php @@ -0,0 +1,8 @@ + + + + + + + + + + + + + + + + + + + + + + +
:
:
:
:
:
diff --git a/views/default/admin/statistics/server/web_server.php b/views/default/admin/statistics/server/web_server.php new file mode 100644 index 000000000..904a54f4b --- /dev/null +++ b/views/default/admin/statistics/server/web_server.php @@ -0,0 +1,16 @@ + + + + + + + + + + +
:
:
-- cgit v1.2.3 From b2bcd510b040b6d065a3a6ad5a4ea36e43db0446 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 8 Jan 2012 17:48:29 -0500 Subject: coding standards fixes - comments --- engine/classes/ElggCache.php | 6 +++--- engine/classes/ElggMenuBuilder.php | 7 ++++--- engine/classes/ElggMenuItem.php | 22 +++++++++++----------- engine/classes/ElggPlugin.php | 6 +++--- engine/classes/ElggPluginPackage.php | 2 ++ engine/classes/ElggSite.php | 4 ++-- engine/lib/access.php | 6 +++--- engine/lib/admin.php | 8 ++++---- engine/lib/database.php | 14 +++++++------- engine/lib/extender.php | 2 +- engine/lib/input.php | 4 ++-- engine/lib/relationships.php | 2 +- engine/lib/river.php | 6 +++--- 13 files changed, 46 insertions(+), 43 deletions(-) (limited to 'engine/lib/admin.php') diff --git a/engine/classes/ElggCache.php b/engine/classes/ElggCache.php index dd53525b8..4317f4be9 100644 --- a/engine/classes/ElggCache.php +++ b/engine/classes/ElggCache.php @@ -191,8 +191,8 @@ abstract class ElggCache implements ArrayAccess { * * @see ArrayAccess::offsetSet() * - * @param mixed $key The key (offset) to assign the value to. - * @param mixed $value The value to set. + * @param mixed $key The key (offset) to assign the value to. + * @param mixed $value The value to set. * * @return void */ @@ -205,7 +205,7 @@ abstract class ElggCache implements ArrayAccess { * * @see ArrayAccess::offsetGet() * - * @param mixed $offset The key (offset) to retrieve. + * @param mixed $key The key (offset) to retrieve. * * @return mixed */ diff --git a/engine/classes/ElggMenuBuilder.php b/engine/classes/ElggMenuBuilder.php index cadfee7f5..6f4ac702e 100644 --- a/engine/classes/ElggMenuBuilder.php +++ b/engine/classes/ElggMenuBuilder.php @@ -16,16 +16,16 @@ class ElggMenuBuilder { /** * ElggMenuBuilder constructor * - * @param string $name Identifier of the menu + * @param array $menu Array of ElggMenuItem objects */ - public function __construct($menu) { + public function __construct(array $menu) { $this->menu = $menu; } /** * Get a prepared menu array * - * @param mixed $sort_by + * @param mixed $sort_by Method to sort the menu by. @see ElggMenuBuilder::sort() * @return array */ public function getMenu($sort_by = 'text') { @@ -80,6 +80,7 @@ class ElggMenuBuilder { /** * Group the menu items into sections + * * @return void */ protected function setupSections() { diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index 62547134a..2512392ad 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -2,12 +2,12 @@ /** * Elgg Menu Item * - * @package Elgg.Core - * @subpackage Navigation - * * To create a menu item that is not a link, pass false for $href. * * @since 1.8.0 + * + * @package Elgg.Core + * @subpackage Navigation */ class ElggMenuItem { @@ -70,9 +70,9 @@ class ElggMenuItem { /** * ElggMenuItem constructor * - * @param string $name Identifier of the menu item - * @param string $text Display text of the menu item - * @param string $href URL of the menu item (false if not a link) + * @param string $name Identifier of the menu item + * @param string $text Display text of the menu item + * @param string $href URL of the menu item (false if not a link) */ public function __construct($name, $text, $href) { //$this->name = $name; @@ -182,7 +182,7 @@ class ElggMenuItem { /** * Set the identifier of the menu item * - * @param string Unique identifier + * @param string $name Unique identifier * @return void */ public function setName($name) { @@ -491,7 +491,7 @@ class ElggMenuItem { /** * Set the parent menu item * - * @param ElggMenuItem $parent + * @param ElggMenuItem $parent The parent of this menu item * @return void */ public function setParent($parent) { @@ -510,7 +510,7 @@ class ElggMenuItem { /** * Add a child menu item * - * @param ElggMenuItem $item + * @param ElggMenuItem $item A child menu item * @return void */ public function addChild($item) { @@ -549,10 +549,10 @@ class ElggMenuItem { /** * Get the menu item content (usually a link) * + * @todo View code in a model. How do we feel about that? + * * @params array $vars Options to pass to output/url if a link * @return string - * - * @todo View code in a model. How do we feel about that? */ public function getContent(array $vars = array()) { diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php index c4d6ec034..33f14ae37 100644 --- a/engine/classes/ElggPlugin.php +++ b/engine/classes/ElggPlugin.php @@ -707,9 +707,9 @@ class ElggPlugin extends ElggObject { * @throws PluginException */ public function start($flags) { -// if (!$this->canActivate()) { -// return false; -// } + //if (!$this->canActivate()) { + // return false; + //} // include classes if ($flags & ELGG_PLUGIN_REGISTER_CLASSES) { diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php index d240af477..2dc4bdb3d 100644 --- a/engine/classes/ElggPluginPackage.php +++ b/engine/classes/ElggPluginPackage.php @@ -303,6 +303,8 @@ class ElggPluginPackage { /** * Returns an array of present and readable text files + * + * @return array */ public function getTextFilenames() { return $this->textFiles; diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index 7ea52a195..b13683a56 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -196,7 +196,7 @@ class ElggSite extends ElggEntity { * * @note You cannot disable the current site. * - * @param string $reason Optional reason for disabling + * @param string $reason Optional reason for disabling * @param bool $recursive Recursively disable all contained entities? * * @return bool @@ -219,7 +219,7 @@ class ElggSite extends ElggEntity { * accepted by elgg_get_entities(). Common parameters * include 'limit', and 'offset'. * Note: this was $limit before version 1.8 - * @param int $offset Offset @deprecated parameter + * @param int $offset Offset @deprecated parameter * * @todo remove $offset in 2.0 * diff --git a/engine/lib/access.php b/engine/lib/access.php index 7be92fbfc..dba1e1ec6 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -984,9 +984,9 @@ function elgg_override_permissions($hook, $type, $value, $params) { } // don't do this so ignore access still works with no one logged in -// if (!$user instanceof ElggUser) { -// return false; -// } + //if (!$user instanceof ElggUser) { + // return false; + //} // check for admin if ($user_guid && elgg_is_admin_user($user_guid)) { diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 1f085eee4..a573e79d6 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -179,10 +179,10 @@ function elgg_admin_notice_exists($id) { * * This function handles registering the parent if it has not been registered. * - * @param string $section The menu section to add to - * @param string $menu_id The unique ID of section - * @param string $parent_id If a child section, the parent section id - * @param int $priority The menu item priority + * @param string $section The menu section to add to + * @param string $menu_id The unique ID of section + * @param string $parent_id If a child section, the parent section id + * @param int $priority The menu item priority * * @return bool * @since 1.8.0 diff --git a/engine/lib/database.php b/engine/lib/database.php index c44fdf1fd..444bb7cc4 100644 --- a/engine/lib/database.php +++ b/engine/lib/database.php @@ -728,9 +728,9 @@ function sanitize_string($string) { /** * Sanitises an integer for database use. * - * @param int $int Integer - * @param bool[optional] $signed Whether negative values should be allowed (true) - * @return int Sanitised integer + * @param int $int Value to be sanitized + * @param bool $signed Whether negative values should be allowed (true) + * @return int */ function sanitise_int($int, $signed = true) { $int = (int) $int; @@ -745,12 +745,12 @@ function sanitise_int($int, $signed = true) { } /** - * Sanitises an integer for database use. + * Sanitizes an integer for database use. * Wrapper function for alternate English spelling (@see sanitise_int) * - * @param int $int Integer - * @param bool[optional] $signed Whether negative values should be allowed (true) - * @return int Sanitised integer + * @param int $int Value to be sanitized + * @param bool $signed Whether negative values should be allowed (true) + * @return int */ function sanitize_int($int, $signed = true) { return sanitise_int($int, $signed); diff --git a/engine/lib/extender.php b/engine/lib/extender.php index 51fc62c30..ffd3c1357 100644 --- a/engine/lib/extender.php +++ b/engine/lib/extender.php @@ -164,9 +164,9 @@ function can_edit_extender($extender_id, $type, $user_guid = 0) { * It is recommended that you do not call this directly, instead use * one of the wrapper functions such as elgg_register_annotation_url_handler(). * - * @param string $function_name The function to register * @param string $extender_type Extender type ('annotation', 'metadata') * @param string $extender_name The name of the extender + * @param string $function_name The function to register * * @return bool */ diff --git a/engine/lib/input.php b/engine/lib/input.php index 57e35786f..dda8211b6 100644 --- a/engine/lib/input.php +++ b/engine/lib/input.php @@ -188,8 +188,8 @@ function elgg_get_sticky_value($form_name, $variable = '', $default = NULL, $fil /** * Get all the values in a sticky form in an array * - * @param string $form_name The name of the form - * @param bool $filter_result Filter for bad input if true + * @param string $form_name The name of the form + * @param bool $filter_result Filter for bad input if true * * @return array * @since 1.8.0 diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php index 5b7080b56..fabe2d2d6 100644 --- a/engine/lib/relationships.php +++ b/engine/lib/relationships.php @@ -399,8 +399,8 @@ function elgg_list_entities_from_relationship_count($options) { /** * Sets the URL handler for a particular relationship type * - * @param string $function_name The function to register * @param string $relationship_type The relationship type. + * @param string $function_name The function to register * * @return bool Depending on success */ diff --git a/engine/lib/river.php b/engine/lib/river.php index 63625878f..547d9495e 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -108,7 +108,7 @@ $posted = 0, $annotation_id = 0) { * * @warning not checking access (should we?) * - * @param array $options + * @param array $options Parameters: * ids => INT|ARR River item id(s) * subject_guids => INT|ARR Subject guid(s) * object_guids => INT|ARR Object guid(s) @@ -215,7 +215,7 @@ function elgg_delete_river(array $options = array()) { * * @note If using types and subtypes in a query, they are joined with an AND. * - * @param array $options + * @param array $options Parameters: * ids => INT|ARR River item id(s) * subject_guids => INT|ARR Subject guid(s) * object_guids => INT|ARR Object guid(s) @@ -548,7 +548,7 @@ function elgg_river_get_action_where_sql($types) { /** * Get the where clause based on river view strings * - * @param array $types Array of view strings + * @param array $views Array of view strings * * @return string * @since 1.8.0 -- cgit v1.2.3