From 82593cd2bc056da73caa1b1e981c5a9ead0f1bf2 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 27 Apr 2011 02:37:16 +0000 Subject: Refs #3362. Plugins don't check deps upon boot. Made package and manifest private properties of ElggPlugin and added ->getPackage() and ->getManifest(). git-svn-id: http://code.elgg.org/elgg/trunk@9030 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggPlugin.php | 74 +++++++++++++++++++++++++----------- engine/classes/ElggPluginPackage.php | 4 +- 2 files changed, 53 insertions(+), 25 deletions(-) (limited to 'engine/classes') diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php index 20a8673de..eb911455a 100644 --- a/engine/classes/ElggPlugin.php +++ b/engine/classes/ElggPlugin.php @@ -9,8 +9,8 @@ * @subpackage Plugins.Settings */ class ElggPlugin extends ElggObject { - public $package; - public $manifest; + private $package; + private $manifest; private $path; private $pluginID; @@ -76,18 +76,6 @@ class ElggPlugin extends ElggObject { // load the rest of the plugin parent::__construct($existing_guid); } - - // We have to let the entity load so we can manipulate it with the API. - // If the path is wrong or would cause an exception, catch it, - // disable the plugin, and emit an error. - try { - $this->package = new ElggPluginPackage($this->path, false); - $this->manifest = $this->package->getManifest(); - } catch (Exception $e) { - // we always have to allow the entity to load. - elgg_log("Failed to load $this->guid as a plugin. " . $e->getMessage(), 'WARNING'); - $this->errorMsg = $e->getmessage(); - } } /** @@ -152,7 +140,7 @@ class ElggPlugin extends ElggObject { * @return array */ public function getAvailableTextFiles() { - $filenames = $this->package->getTextFilenames(); + $filenames = $this->getPackage()->getTextFilenames(); $files = array(); foreach ($filenames as $filename) { @@ -562,13 +550,13 @@ class ElggPlugin extends ElggObject { return false; } - if (!$this->package instanceof ElggPluginPackage) { + if (!$this->getPackage() instanceof ElggPluginPackage) { $this->errorMsg = elgg_echo('ElggPlugin:NoPluginPackagePackage', array($this->getID(), $this->guid)); return false; } - if (!$this->package->isValid()) { - $this->errorMsg = $this->package->getError(); + if (!$this->getPackage()->isValid()) { + $this->errorMsg = $this->getPackage()->getError(); return false; } @@ -607,8 +595,8 @@ class ElggPlugin extends ElggObject { * @return bool */ public function canActivate($site_guid = null) { - if ($this->package) { - return $this->package->isValid() && $this->package->checkDependencies(); + if ($this->getPackage()) { + return $this->getPackage()->isValid() && $this->getPackage()->checkDependencies(); } return false; @@ -708,9 +696,9 @@ class ElggPlugin extends ElggObject { * @throws PluginException */ public function start($flags) { - if (!$this->canActivate()) { - return false; - } +// if (!$this->canActivate()) { +// return false; +// } // include start file if ($flags & ELGG_PLUGIN_INCLUDE_START) { @@ -958,4 +946,44 @@ class ElggPlugin extends ElggObject { public function getError() { return $this->errorMsg; } + + /** + * Returns this plugin's ElggPluginManifest object + * + * @return ElggPluginManifest + */ + public function getManifest() { + if ($this->manifest instanceof ElggPluginManifest) { + return $this->manifest; + } + + try { + $this->manifest = $this->getPackage()->getManifest(); + } catch (Exception $e) { + elgg_log("Failed to load manifest for plugin $this->guid. " . $e->getMessage(), 'WARNING'); + $this->errorMsg = $e->getmessage(); + } + + return $this->manifest; + } + + /** + * Returns this plugin's ElggPluginPackage object + * + * @return ElggPluginPackage + */ + public function getPackage() { + if ($this->package instanceof ElggPluginPackage) { + return $this->package; + } + + try { + $this->package = new ElggPluginPackage($this->path, false); + } catch (Exception $e) { + elgg_log("Failed to load package for $this->guid. " . $e->getMessage(), 'WARNING'); + $this->errorMsg = $e->getmessage(); + } + + return $this->package; + } } diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php index 4daab381e..bad99362f 100644 --- a/engine/classes/ElggPluginPackage.php +++ b/engine/classes/ElggPluginPackage.php @@ -334,13 +334,13 @@ class ElggPluginPackage { // first, check if any active plugin conflicts with us. foreach ($enabled_plugins as $plugin) { - $temp_conflicts = $plugin->manifest->getConflicts(); + $temp_conflicts = $plugin->getManifest()->getConflicts(); foreach ($temp_conflicts as $conflict) { if ($conflict['type'] == 'plugin' && $conflict['name'] == $this_id) { $result = $this->checkDepPlugin($conflict, $enabled_plugins, false); // rewrite the conflict to show the originating plugin - $conflict['name'] = $plugin->manifest->getName(); + $conflict['name'] = $plugin->getManifest()->getName(); if (!$full_report && !$result['status']) { return $result['status']; -- cgit v1.2.3 From f1de8bebee841749c342df0a34591a84d8d5d4e3 Mon Sep 17 00:00:00 2001 From: brettp Date: Mon, 9 May 2011 00:51:17 +0000 Subject: Fixes 3426. Not using a horrible variable name and fixing the bug created by it. git-svn-id: http://code.elgg.org/elgg/trunk@9057 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggPluginPackage.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'engine/classes') diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php index bad99362f..9aa4af8bf 100644 --- a/engine/classes/ElggPluginPackage.php +++ b/engine/classes/ElggPluginPackage.php @@ -455,8 +455,8 @@ class ElggPluginPackage { */ private function checkDepPriority(array $dep, array $plugins, $inverse = false) { // grab the ElggPlugin using this package. - $this_plugin = elgg_get_plugin_from_id($this->getID()); - $this_priority = $this_plugin->getPriority(); + $plugin_package = elgg_get_plugin_from_id($this->getID()); + $plugin_priority = $plugin_package->getPriority(); foreach ($plugins as $test_plugin) { if ($test_plugin->getID() == $dep['plugin']) { @@ -466,8 +466,7 @@ class ElggPluginPackage { // If this isn't a plugin or there are no active plugins, // we can't satisfy this dep. - // Assume everything is ok. See #2946. - if (!$this->plugin || !$plugins) { + if (!$plugin_package || !$plugins) { return array( 'status' => true, 'value' => 'uninstalled' @@ -478,11 +477,11 @@ class ElggPluginPackage { switch ($dep['priority']) { case 'before': - $status = $this_priority < $test_plugin_priority; + $status = $plugin_priority < $test_plugin_priority; break; case 'after': - $status = $this_priority > $test_plugin_priority; + $status = $plugin_priority > $test_plugin_priority; break; default; @@ -490,7 +489,7 @@ class ElggPluginPackage { } // get the current value - if ($this_priority < $test_plugin_priority) { + if ($plugin_priority < $test_plugin_priority) { $value = 'before'; } else { $value = 'after'; -- cgit v1.2.3 From 81d6884ecad771f4b4f2d8be7572d1a89deaab10 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 19 May 2011 11:21:53 +0000 Subject: Fixes #3462 empty classes directory is no longer treated as an error git-svn-id: http://code.elgg.org/elgg/trunk@9100 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggPlugin.php | 7 +------ engine/lib/elgglib.php | 8 +------- languages/en.php | 1 - 3 files changed, 2 insertions(+), 14 deletions(-) (limited to 'engine/classes') diff --git a/engine/classes/ElggPlugin.php b/engine/classes/ElggPlugin.php index eb911455a..95a7362e2 100644 --- a/engine/classes/ElggPlugin.php +++ b/engine/classes/ElggPlugin.php @@ -839,12 +839,7 @@ class ElggPlugin extends ElggObject { return true; } - // but need to have working ones. - if (!elgg_register_classes($classes_path)) { - $msg = elgg_echo('ElggPlugin:Exception:CannotRegisterClasses', - array($this->getID(), $this->guid, $classes_path)); - throw new PluginException($msg); - } + elgg_register_classes($classes_path); return true; } diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index e67f8b627..170750849 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -33,21 +33,15 @@ function _elgg_autoload($class) { * * @param string $dir The dir to look in * - * @return true + * @return void * @since 1.8.0 */ function elgg_register_classes($dir) { $classes = elgg_get_file_list($dir, array(), array(), array('.php')); - if (!$classes) { - return false; - } - foreach ($classes as $class) { elgg_register_class(basename($class, '.php'), $class); } - - return true; } /** diff --git a/languages/en.php b/languages/en.php index ec39f64a9..768658c99 100644 --- a/languages/en.php +++ b/languages/en.php @@ -81,7 +81,6 @@ $english = array( 'ElggPlugin:Exception:CannotIncludeFile' => 'Cannot include %s for plugin %s (guid: %s) at %s. Check permissions!', 'ElggPlugin:Exception:CannotRegisterViews' => 'Cannot open views dir for plugin %s (guid: %s) at %s. Check permissions!', 'ElggPlugin:Exception:CannotRegisterLanguages' => 'Cannot register languages for plugin %s (guid: %s) at %s. Check permissions!', - 'ElggPlugin:Exception:CannotRegisterClasses' => 'Cannot register classes for plugin %s (guid: %s) at %s. Check permissions!', 'ElggPlugin:Exception:NoID' => 'No ID for plugin guid %s!', 'PluginException:ParserError' => 'Error parsing manifest with API version %s in plugin %s.', -- cgit v1.2.3 From 9a68be3c337ed98475535ab6b0483f53073678e1 Mon Sep 17 00:00:00 2001 From: brettp Date: Tue, 24 May 2011 17:59:51 +0000 Subject: Fixes #3467. Fixed bugs in priority deps. Can now disable active plugins with unmet dependencies. git-svn-id: http://code.elgg.org/elgg/trunk@9111 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggPluginPackage.php | 13 +++---- languages/en.php | 1 + views/default/css/admin.php | 9 ++++- views/default/object/plugin/advanced.php | 61 +++++++++++++++++++------------- 4 files changed, 50 insertions(+), 34 deletions(-) (limited to 'engine/classes') diff --git a/engine/classes/ElggPluginPackage.php b/engine/classes/ElggPluginPackage.php index 9aa4af8bf..977b72d76 100644 --- a/engine/classes/ElggPluginPackage.php +++ b/engine/classes/ElggPluginPackage.php @@ -457,16 +457,11 @@ class ElggPluginPackage { // grab the ElggPlugin using this package. $plugin_package = elgg_get_plugin_from_id($this->getID()); $plugin_priority = $plugin_package->getPriority(); + $test_plugin = elgg_get_plugin_from_id($dep['plugin']); - foreach ($plugins as $test_plugin) { - if ($test_plugin->getID() == $dep['plugin']) { - break; - } - } - - // If this isn't a plugin or there are no active plugins, - // we can't satisfy this dep. - if (!$plugin_package || !$plugins) { + // If this isn't a plugin or the plugin isn't installed or active + // priority doesn't matter. Use requires to check if a plugin is active. + if (!$plugin_package || !$test_plugin || !$test_plugin->isActive()) { return array( 'status' => true, 'value' => 'uninstalled' diff --git a/languages/en.php b/languages/en.php index 509de7fb0..83fb66dad 100644 --- a/languages/en.php +++ b/languages/en.php @@ -661,6 +661,7 @@ $english = array( 'admin:plugins:simple_simple_fail' => 'Could not save settings.', 'admin:plugins:simple_simple_success' => 'Settings saved.', 'admin:plugins:simple:cannot_activate' => 'Cannot activate this plugin. Check the advanced plugin admin area for more information.', + 'admin:plugins:warning:unmet_dependencies_active' => 'This plugin is active but has unmet dependencies. You may encounter problems. See "more info" below for details.', 'admin:plugins:dependencies:type' => 'Type', 'admin:plugins:dependencies:name' => 'Name', diff --git a/views/default/css/admin.php b/views/default/css/admin.php index c4dacad91..744211a20 100644 --- a/views/default/css/admin.php +++ b/views/default/css/admin.php @@ -1179,12 +1179,19 @@ ul.admin_plugins { .elgg-plugin.elgg-state-inactive { background: #dedede; } -.elgg-dependency.elgg-state-error { + +.elgg-state-error { background: #fbe3e4; color: #8a1f11; border-color: #fbc2c4; font-weight: bold; } +.elgg-state-warning { + background: #fbedb5; + color: #000000; + border-color: #fbe58b; + font-weight: bold; +} .admin_notices { padding-bottom: 15px; diff --git a/views/default/object/plugin/advanced.php b/views/default/object/plugin/advanced.php index 9aed4163c..56e680ad5 100644 --- a/views/default/object/plugin/advanced.php +++ b/views/default/object/plugin/advanced.php @@ -20,7 +20,6 @@ $actions_base = '/action/admin/plugins/'; $ts = time(); $token = generate_action_token($ts); -$active_class = ($active && $can_activate) ? 'elgg-state-active' : 'elgg-state-inactive'; // build reordering links $links = ''; @@ -80,33 +79,42 @@ if ($priority < $max_priority) { } // activate / deactivate links -if ($can_activate) { - if ($active) { - $action = 'deactivate'; - $class = 'elgg-button-cancel'; - } else { - $action = 'activate'; - $class = 'elgg-button-submit'; + +// always let them deactivate +$options = array( + 'is_action' => true +); +if ($active) { + $active_class = 'elgg-state-active'; + $action = 'deactivate'; + $options['text'] = elgg_echo('deactivate'); + $options['class'] = "elgg-button elgg-button-cancel"; + + if (!$can_activate) { + $active_class = 'elgg-state-active'; + $options['class'] = 'elgg-button elgg-state-warning'; } +} else if ($can_activate) { + $active_class = 'elgg-state-inactive'; + $action = 'activate'; + $options['text'] = elgg_echo('activate'); + $options['class'] = "elgg-button elgg-button-submit"; +} else { + $active_class = 'elgg-state-inactive'; + $action = ''; + $options['text'] = elgg_echo('admin:plugins:cannot_activate'); + $options['class'] = "elgg-button elgg-button-disabled"; + $options['disabled'] = 'disabled'; +} +if ($action) { $url = elgg_http_add_url_query_elements($actions_base . $action, array( - 'plugin_guids[]' => $plugin->guid, - 'is_action' => true + 'plugin_guids[]' => $plugin->guid )); - $action_button = elgg_view('output/url', array( - 'href' => $url, - 'text' => elgg_echo($action), - 'is_action' => true, - 'class' => "elgg-button $class" - )); -} else { - $action_button = elgg_view('output/url', array( - 'text' => elgg_echo('admin:plugins:cannot_activate'), - 'disabled' => 'disabled', - 'class' => "elgg-button elgg-button-action elgg-state-disabled" - )); + $options['href'] = $url; } +$action_button = elgg_view('output/url', $options); // Display categories $categories_html = ''; @@ -202,8 +210,13 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new) } if (!$can_activate) { - $message = elgg_echo('admin:plugins:warning:unmet_dependencies'); - echo "

$message

"; + if ($active) { + $message = elgg_echo('admin:plugins:warning:unmet_dependencies_active'); + echo "

$message

"; + } else { + $message = elgg_echo('admin:plugins:warning:unmet_dependencies'); + echo "

$message

"; + } } ?> -- cgit v1.2.3 From d924a462f39ff922a4cc9f6635cfe5d0c0f14db3 Mon Sep 17 00:00:00 2001 From: brettp Date: Tue, 7 Jun 2011 22:10:39 +0000 Subject: Refs #3510, #3433. Ported r9062 to trunk. Fix for comment hook returning 0 comments. git-svn-id: http://code.elgg.org/elgg/trunk@9139 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggEntity.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'engine/classes') diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index 79b8c2a4e..8fc1e46cb 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -850,12 +850,11 @@ abstract class ElggEntity extends ElggData implements * @since 1.8.0 */ function countComments() { - $type = $this->getType(); $params = array('entity' => $this); - $number = elgg_trigger_plugin_hook('comments:count', $type, $params, false); + $num = trigger_plugin_hook('comments:count', $this->getType(), $params); - if ($number) { - return $number; + if (is_int($num)) { + return $num; } else { return $this->getAnnotationCalculation('generic_comment', 'count'); } -- cgit v1.2.3 From a3a84cec2f5424a9195c38f299161278a623913a Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 11 Jun 2011 14:01:13 +0000 Subject: sorting plugin settings menu items by text git-svn-id: http://code.elgg.org/elgg/trunk@9169 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggMenuItem.php | 11 +++++++++++ engine/lib/admin.php | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) (limited to 'engine/classes') diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index 61dbf539e..caaba49a1 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -419,6 +419,17 @@ class ElggMenuItem { $this->children[] = $item; } + /** + * Set the menu item's children + * + * @param array $children Array of ElggMenuItems + * + * @return void + */ + public function setChildren($children) { + $this->children = $children; + } + /** * Get the children menu items * diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 6ef626f81..3bfb69102 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -211,7 +211,7 @@ function elgg_register_admin_menu_item($section, $menu_id, $parent_id = NULL, $p } /** - * Initialise the admin backend. + * Initialize the admin backend. * * @return void */ @@ -284,6 +284,11 @@ function admin_init() { // plugin settings are added in elgg_admin_add_plugin_settings_menu() via the admin page handler // for performance reasons. + // we want plugin settings menu items to be sorted alphabetical + if (elgg_in_context('admin')) { + elgg_register_plugin_hook_handler('prepare', 'menu:page', 'elgg_admin_sort_page_menu'); + } + if (elgg_is_admin_logged_in()) { elgg_register_menu_item('topbar', array( 'name' => 'administration', @@ -321,6 +326,7 @@ function admin_init() { * * @return void * @access private + * @since 1.8.0 */ function elgg_admin_add_plugin_settings_menu() { @@ -347,6 +353,33 @@ function elgg_admin_add_plugin_settings_menu() { } } +/** + * Sort the plugin settings menu items + * + * @param string $hook + * @param string $type + * @param array $return + * @param array $params + * + * @return void + * @since 1.8.0 + */ +function elgg_admin_sort_page_menu($hook, $type, $return, $params) { + $configure_items = $return['configure']; + foreach ($configure_items as $menu_item) { + if ($menu_item->getName() == 'settings') { + $settings = $menu_item; + } + } + + // keep the basic and advanced settings at the top + $children = $settings->getChildren(); + $site_settings = array_splice($children, 0, 2); + usort($children, array('ElggMenuBuilder', 'compareByText')); + array_splice($children, 0, 0, $site_settings); + $settings->setChildren($children); +} + /** * Handles any set up required for administration pages * -- cgit v1.2.3 From 0e39eac3459d2ff698b51e87a469a2790e510a19 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 11 Jun 2011 15:56:11 +0000 Subject: Fixes #3515 created a unified page handler for account pages git-svn-id: http://code.elgg.org/elgg/trunk@9175 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggSite.php | 2 +- engine/lib/users.php | 60 ++++++++-------------- pages/account/forgotten_password.php | 2 - pages/account/reset_password.php | 35 +++++++++++++ views/default/core/account/login_walled_garden.php | 2 +- views/default/forms/login.php | 2 +- 6 files changed, 58 insertions(+), 45 deletions(-) create mode 100644 pages/account/reset_password.php (limited to 'engine/classes') diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index d3cb0d488..30b222c24 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -400,7 +400,7 @@ class ElggSite extends ElggEntity { 'action/login', 'register', 'action/register', - 'pages/account/forgotten_password\.php', + 'forgotpassword', 'action/user/requestnewpassword', 'resetpassword', 'upgrade\.php', diff --git a/engine/lib/users.php b/engine/lib/users.php index 832bcd529..8333888a2 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -747,40 +747,6 @@ function execute_new_password_request($user_guid, $conf_code) { return FALSE; } -/** - * Handles pages for password reset requests. - * - * @param array $page Pages array - * - * @return void - */ -function elgg_user_resetpassword_page_handler($page) { - - $user_guid = get_input('u'); - $code = get_input('c'); - - $user = get_entity($user_guid); - - // don't check code here to avoid automated attacks - if (!$user instanceof ElggUser) { - register_error(elgg_echo('user:passwordreset:unknown_user')); - forward(); - } - - $params = array( - 'guid' => $user_guid, - 'code' => $code, - ); - $form = elgg_view_form('user/passwordreset', array(), $params); - - $title = elgg_echo('resetpassword'); - $content = elgg_view_title(elgg_echo('resetpassword')) . $form; - - $body = elgg_view_layout('one_column', array('content' => $content)); - - echo elgg_view_page($title, $body); -} - /** * Simple function that will generate a random clear text password * suitable for feeding into generate_user_password(). @@ -1129,14 +1095,27 @@ function collections_page_handler($page_elements) { } /** - * Page handler for registration + * Page handler for account related pages * - * @param array $page_elements Page elements + * @param array $page_elements Page elements + * @param string $handler The handler string * * @return void */ -function registration_page_handler($page_elements) { - require_once(dirname(dirname(dirname(__FILE__))) . "/pages/account/register.php"); +function elgg_user_account_page_handler($page_elements, $handler) { + + $base_dir = elgg_get_root_path() . 'pages/account'; + switch ($handler) { + case 'forgotpassword': + require_once("$base_dir/forgotten_password.php"); + break; + case 'resetpassword': + require_once("$base_dir/reset_password.php"); + break; + case 'register': + require_once("$base_dir/register.php"); + break; + } } /** @@ -1513,8 +1492,9 @@ function users_init() { elgg_register_page_handler('friends', 'friends_page_handler'); elgg_register_page_handler('friendsof', 'friends_of_page_handler'); - elgg_register_page_handler('register', 'registration_page_handler'); - elgg_register_page_handler('resetpassword', 'elgg_user_resetpassword_page_handler'); + elgg_register_page_handler('register', 'elgg_user_account_page_handler'); + elgg_register_page_handler('forgotpassword', 'elgg_user_account_page_handler'); + elgg_register_page_handler('resetpassword', 'elgg_user_account_page_handler'); elgg_register_page_handler('login', 'elgg_user_login_page_handler'); elgg_register_page_handler('avatar', 'elgg_avatar_page_handler'); elgg_register_page_handler('profile', 'elgg_profile_page_handler'); diff --git a/pages/account/forgotten_password.php b/pages/account/forgotten_password.php index 93d786e22..7679eaa55 100644 --- a/pages/account/forgotten_password.php +++ b/pages/account/forgotten_password.php @@ -6,8 +6,6 @@ * @subpackage Registration */ -require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - if (elgg_is_logged_in()) { forward(); } diff --git a/pages/account/reset_password.php b/pages/account/reset_password.php new file mode 100644 index 000000000..019ec3add --- /dev/null +++ b/pages/account/reset_password.php @@ -0,0 +1,35 @@ + $user_guid, + 'code' => $code, +); +$form = elgg_view_form('user/passwordreset', array(), $params); + +$title = elgg_echo('resetpassword'); +$content = elgg_view_title(elgg_echo('resetpassword')) . $form; + +$body = elgg_view_layout('one_column', array('content' => $content)); + +echo elgg_view_page($title, $body); diff --git a/views/default/core/account/login_walled_garden.php b/views/default/core/account/login_walled_garden.php index 9b5019096..1606b9592 100644 --- a/views/default/core/account/login_walled_garden.php +++ b/views/default/core/account/login_walled_garden.php @@ -6,7 +6,7 @@ */ $reg_url = elgg_normalize_url('register'); -$forgot_url = elgg_normalize_url('pages/account/forgotten_password.php'); +$forgot_url = elgg_normalize_url('forgotpassword'); $cancel_button = elgg_view('input/button', array( 'value' => elgg_echo('cancel'), 'class' => 'elgg-button-cancel mlm', diff --git a/views/default/forms/login.php b/views/default/forms/login.php index 452c4c425..5cfdcd4c6 100644 --- a/views/default/forms/login.php +++ b/views/default/forms/login.php @@ -39,7 +39,7 @@ echo '
  • ' . elgg_echo('register') . '
  • '; } ?> -
  • +
  • \ No newline at end of file -- cgit v1.2.3 From ba88a1c96ab89b4afcc574e3fc8a71df640a9fd8 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 12 Jun 2011 21:07:49 +0000 Subject: Fixes #2910 set the site_guid of site entities git-svn-id: http://code.elgg.org/elgg/trunk@9192 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggSite.php | 9 +++++++ ...8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php | 30 ++++++++++++++++++++++ version.php | 2 +- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php (limited to 'engine/classes') diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php index 30b222c24..e3b8b8f1a 100644 --- a/engine/classes/ElggSite.php +++ b/engine/classes/ElggSite.php @@ -148,11 +148,20 @@ class ElggSite extends ElggEntity { * @return bool */ public function save() { + global $CONFIG; + // Save generic stuff if (!parent::save()) { return false; } + // make sure the site guid is set (if not, set to self) + if (!$this->get('site_guid')) { + $guid = $this->get('guid'); + update_data("UPDATE {$CONFIG->dbprefix}entities SET site_guid=$guid + WHERE guid=$guid"); + } + // Now save specific stuff return create_site_entity($this->get('guid'), $this->get('name'), $this->get('description'), $this->get('url')); diff --git a/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php b/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php new file mode 100644 index 000000000..4fc59ac41 --- /dev/null +++ b/engine/lib/upgrades/2011061200-1.8b1-sites_need_a_site_guid-6d9dcbf46c0826cc.php @@ -0,0 +1,30 @@ + 'site', + 'site_guid' => 0, +); +$batch = new ElggBatch('elgg_get_entities', $options); + +foreach ($batch as $entity) { + if (!$entity->site_guid) { + update_data("UPDATE {$CONFIG->dbprefix}entities SET site_guid=$entity->guid + WHERE guid=$entity->guid"); + } +} + +access_show_hidden_entities($access_status); +elgg_set_ignore_access($ia); diff --git a/version.php b/version.php index d1cc63aef..9d3bf43e3 100644 --- a/version.php +++ b/version.php @@ -11,7 +11,7 @@ // YYYYMMDD = Elgg Date // XX = Interim incrementer -$version = 2011052801; +$version = 2011061200; // Human-friendly version name $release = '1.8b1'; -- cgit v1.2.3 From a420910a8b782bae53fbd7f86102db9f9b831388 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 13 Jun 2011 01:46:50 +0000 Subject: Fixes #3282 always using a menu item's name in its class git-svn-id: http://code.elgg.org/elgg/trunk@9200 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggMenuItem.php | 11 ++++++++++- views/default/navigation/menu/elements/item.php | 8 +------- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'engine/classes') diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php index caaba49a1..157ed9ceb 100644 --- a/engine/classes/ElggMenuItem.php +++ b/engine/classes/ElggMenuItem.php @@ -325,7 +325,16 @@ class ElggMenuItem { * @return string */ public function getItemClass() { - return implode(' ', $this->itemClass); + //allow people to specify name with underscores and colons + $name = str_replace('_', '-', $this->getName()); + $name = str_replace(':', '-', $name); + + $class = implode(' ', $this->itemClass); + if ($class) { + return "elgg-menu-item-$name $class"; + } else { + return "elgg-menu-item-$name"; + } } /** diff --git a/views/default/navigation/menu/elements/item.php b/views/default/navigation/menu/elements/item.php index 55ddc2fe4..f3e46315b 100644 --- a/views/default/navigation/menu/elements/item.php +++ b/views/default/navigation/menu/elements/item.php @@ -22,13 +22,7 @@ if ($children) { $item_class = $item->getItemClass(); -//allow people to specify name with underscores -$name = str_replace('_', '-', $item->getName()); -if ($item_class) { - $class = "class=\"elgg-menu-item-$name $item_class\""; -} - -echo "
  • "; +echo "
  • "; echo $item->getContent(); if ($children) { echo elgg_view('navigation/menu/elements/section', array( -- cgit v1.2.3