diff options
Diffstat (limited to 'actions')
-rw-r--r-- | actions/admin/plugins/activate.php | 4 | ||||
-rw-r--r-- | actions/admin/plugins/activate_all.php | 4 | ||||
-rw-r--r-- | actions/admin/plugins/deactivate.php | 4 | ||||
-rw-r--r-- | actions/admin/plugins/deactivate_all.php | 4 | ||||
-rw-r--r-- | actions/admin/plugins/set_priority.php | 4 | ||||
-rw-r--r-- | actions/admin/plugins/simple_update_states.php | 48 | ||||
-rw-r--r-- | actions/avatar/crop.php | 10 | ||||
-rw-r--r-- | actions/avatar/upload.php | 23 | ||||
-rw-r--r-- | actions/useradd.php | 15 | ||||
-rw-r--r-- | actions/widgets/save.php | 20 |
10 files changed, 62 insertions, 74 deletions
diff --git a/actions/admin/plugins/activate.php b/actions/admin/plugins/activate.php index 0049878e3..224b5a2ae 100644 --- a/actions/admin/plugins/activate.php +++ b/actions/admin/plugins/activate.php @@ -29,7 +29,9 @@ foreach ($plugin_guids as $guid) { if ($plugin->activate()) { $activated_guids[] = $guid; } else { - register_error(elgg_echo('admin:plugins:activate:no', array($plugin->getManifest()->getName()))); + $msg = $plugin->getError(); + $string = ($msg) ? 'admin:plugins:activate:no_with_msg' : 'admin:plugins:activate:no'; + register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError()))); } } diff --git a/actions/admin/plugins/activate_all.php b/actions/admin/plugins/activate_all.php index 19eb82142..19c142346 100644 --- a/actions/admin/plugins/activate_all.php +++ b/actions/admin/plugins/activate_all.php @@ -18,7 +18,9 @@ foreach ($guids as $guid) { if ($plugin->activate()) { //system_message(elgg_echo('admin:plugins:activate:yes', array($plugin->getManifest()->getName()))); } else { - register_error(elgg_echo('admin:plugins:activate:no', array($plugin->getManifest()->getName()))); + $msg = $plugin->getError(); + $string = ($msg) ? 'admin:plugins:activate:no_with_msg' : 'admin:plugins:activate:no'; + register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError()))); } } } diff --git a/actions/admin/plugins/deactivate.php b/actions/admin/plugins/deactivate.php index f5eca3aaa..2ce796eff 100644 --- a/actions/admin/plugins/deactivate.php +++ b/actions/admin/plugins/deactivate.php @@ -28,7 +28,9 @@ foreach ($plugin_guids as $guid) { if ($plugin->deactivate()) { //system_message(elgg_echo('admin:plugins:deactivate:yes', array($plugin->getManifest()->getName()))); } else { - register_error(elgg_echo('admin:plugins:deactivate:no', array($plugin->getManifest()->getName()))); + $msg = $plugin->getError(); + $string = ($msg) ? 'admin:plugins:deactivate:no_with_msg' : 'admin:plugins:deactivate:no'; + register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError()))); } } diff --git a/actions/admin/plugins/deactivate_all.php b/actions/admin/plugins/deactivate_all.php index 436a3ad30..479e9c607 100644 --- a/actions/admin/plugins/deactivate_all.php +++ b/actions/admin/plugins/deactivate_all.php @@ -18,7 +18,9 @@ foreach ($guids as $guid) { if ($plugin->deactivate()) { //system_message(elgg_echo('admin:plugins:activate:yes', array($plugin->getManifest()->getName()))); } else { - register_error(elgg_echo('admin:plugins:deactivate:no', array($plugin->getManifest()->getName()))); + $msg = $plugin->getError(); + $string = ($msg) ? 'admin:plugins:deactivate:no_with_msg' : 'admin:plugins:deactivate:no'; + register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError()))); } } } diff --git a/actions/admin/plugins/set_priority.php b/actions/admin/plugins/set_priority.php index 1f8bc24af..79b1c4c53 100644 --- a/actions/admin/plugins/set_priority.php +++ b/actions/admin/plugins/set_priority.php @@ -26,7 +26,9 @@ if (!($plugin instanceof ElggPlugin)) { if ($plugin->setPriority($priority)) { //system_message(elgg_echo('admin:plugins:set_priority:yes', array($plugin->getManifest()->getName()))); } else { - register_error(elgg_echo('admin:plugins:set_priority:no', array($plugin->getManifest()->getName()))); + $msg = $plugin->getError(); + $string = ($msg) ? 'admin:plugins:set_priority:no_with_msg' : 'admin:plugins:set_priority:no'; + register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError()))); } // don't regenerate the simplecache because the plugin won't be diff --git a/actions/admin/plugins/simple_update_states.php b/actions/admin/plugins/simple_update_states.php deleted file mode 100644 index 7601013a7..000000000 --- a/actions/admin/plugins/simple_update_states.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * Bulk activate/deactivate for plugins appearing in the "simple" interface. - * - * Plugins marked as using the "simple" interface can be activated/deactivated - * en masse by passing the plugins to activate as an array of their plugin guids - * in $_REQUEST['enabled_plugins']. All "simple" plugins not in this array will be - * deactivated. - * - * Simplecache and views cache are reset. - * - * @uses array $_REQUEST['activated_plugin_guids'] Array of plugin guids to activate. - * - * @since 1.8 - * @package Elgg.Core - * @subpackage Administration.Plugins - */ - -$active_plugin_guids = get_input('active_plugin_guids', array()); -$installed_plugins = elgg_get_plugins('any'); -$success = TRUE; - -foreach ($installed_plugins as $plugin) { - // this is only for simple plugins. - if ($plugin->getManifest()->getAdminInterface() != 'simple') { - continue; - } - - // only effect changes to plugins not already in that state. - if ($plugin->isActive() && !in_array($plugin->guid, $active_plugin_guids)) { - $success = $success && $plugin->deactivate(); - } elseif (!$plugin->isActive() && in_array($plugin->guid, $active_plugin_guids)) { - $success = $success && $plugin->activate(); - } -} - -if ($success) { - //system_message(elgg_echo('admin:plugins:simple_simple_success')); -} else { - register_error(elgg_echo('admin:plugins:simple_simple_fail')); -} - -// don't regenerate the simplecache because the plugin won't be -// loaded until next run. Just invalidate and let it regnerate as needed -elgg_invalidate_simplecache(); -elgg_filepath_cache_reset(); - -forward(REFERER);
\ No newline at end of file diff --git a/actions/avatar/crop.php b/actions/avatar/crop.php index 9c57530ae..6d71b6f06 100644 --- a/actions/avatar/crop.php +++ b/actions/avatar/crop.php @@ -22,14 +22,8 @@ $filehandler->owner_guid = $owner->getGUID(); $filehandler->setFilename("profile/" . $owner->guid . "master" . ".jpg"); $filename = $filehandler->getFilenameOnFilestore(); -//@todo make this configurable? -$icon_sizes = array( - 'topbar' => array('w'=>16, 'h'=>16, 'square'=>TRUE, 'upscale'=>TRUE), - 'tiny' => array('w'=>25, 'h'=>25, 'square'=>TRUE, 'upscale'=>TRUE), - 'small' => array('w'=>40, 'h'=>40, 'square'=>TRUE, 'upscale'=>TRUE), - 'medium' => array('w'=>100, 'h'=>100, 'square'=>TRUE, 'upscale'=>TRUE), - 'large' => array('w'=>200, 'h'=>200, 'square'=>FALSE, 'upscale'=>FALSE) -); +$icon_sizes = elgg_get_config('icon_sizes'); +unset($icon_sizes['master']); // get the images and save their file handlers into an array // so we can do clean up if one fails. diff --git a/actions/avatar/upload.php b/actions/avatar/upload.php index 19976ea87..0752615e0 100644 --- a/actions/avatar/upload.php +++ b/actions/avatar/upload.php @@ -11,15 +11,12 @@ if (!$owner || !($owner instanceof ElggUser) || !$owner->canEdit()) { forward(REFERER); } -//@todo make this configurable? -$icon_sizes = array( - 'topbar' => array('w'=>16, 'h'=>16, 'square'=>TRUE, 'upscale'=>TRUE), - 'tiny' => array('w'=>25, 'h'=>25, 'square'=>TRUE, 'upscale'=>TRUE), - 'small' => array('w'=>40, 'h'=>40, 'square'=>TRUE, 'upscale'=>TRUE), - 'medium' => array('w'=>100, 'h'=>100, 'square'=>TRUE, 'upscale'=>TRUE), - 'large' => array('w'=>200, 'h'=>200, 'square'=>FALSE, 'upscale'=>TRUE), - 'master' => array('w'=>550, 'h'=>550, 'square'=>FALSE, 'upscale'=>FALSE) -); +if ($_FILES['avatar']['error'] != 0) { + register_error(elgg_echo('avatar:upload:fail')); + forward(REFERER); +} + +$icon_sizes = elgg_get_config('icon_sizes'); // get the images and save their file handlers into an array // so we can do clean up if one fails. @@ -42,11 +39,17 @@ foreach ($icon_sizes as $name => $size_info) { $file->delete(); } - system_message(elgg_echo('avatar:resize:fail')); + register_error(elgg_echo('avatar:resize:fail')); forward(REFERER); } } +// reset crop coordinates +$owner->x1 = 0; +$owner->x2 = 0; +$owner->y1 = 0; +$owner->y2 = 0; + $owner->icontime = time(); if (elgg_trigger_event('profileiconupdate', $owner->type, $owner)) { system_message(elgg_echo("avatar:upload:success")); diff --git a/actions/useradd.php b/actions/useradd.php index 8e588d073..3df41af79 100644 --- a/actions/useradd.php +++ b/actions/useradd.php @@ -20,13 +20,24 @@ if (is_array($admin)) { $admin = $admin[0]; } +// no blank fields +if ($username == '' || $password == '' || $password2 == '' || $email == '' || $name == '') { + register_error(elgg_echo('register:fields')); + forward(REFERER); +} + +if (strcmp($password, $password2) != 0) { + register_error(elgg_echo('RegistrationException:PasswordMismatch')); + forward(REFERER); +} + // For now, just try and register the user try { $guid = register_user($username, $password, $name, $email, TRUE); - if (((trim($password) != "") && (strcmp($password, $password2) == 0)) && ($guid)) { + if ($guid) { $new_user = get_entity($guid); - if (($guid) && ($admin)) { + if ($uew_user && $admin && elgg_is_admin_logged_in()) { $new_user->makeAdmin(); } diff --git a/actions/widgets/save.php b/actions/widgets/save.php index 0a2de0c4d..e15deab77 100644 --- a/actions/widgets/save.php +++ b/actions/widgets/save.php @@ -4,6 +4,14 @@ * * @package Elgg.Core * @subpackage Widgets.Management + * + * @uses int $_REQUEST['guid'] The guid of the widget to save + * @uses array $_REQUEST['params'] An array of params to set on the widget. + * @uses int $_REQUEST['default_widgets'] Flag for if these settings are for default wigets. + * @uses string $_REQUEST['context'] An optional context of the widget. Used to return + * the correct output if widget content changes + * depending on context. + * */ elgg_set_context('widgets'); @@ -11,12 +19,22 @@ elgg_set_context('widgets'); $guid = get_input('guid'); $params = get_input('params'); $default_widgets = get_input('default_widgets', 0); +$context = get_input('context'); $widget = get_entity($guid); if ($widget && $widget->saveSettings($params)) { elgg_set_page_owner_guid($widget->getContainerGUID()); + if ($context) { + elgg_push_context($context); + } + if (!$default_widgets) { - $view = "widgets/$widget->handler/content"; + if (elgg_view_exists("widgets/$widget->handler/content")) { + $view = "widgets/$widget->handler/content"; + } else { + elgg_deprecated_notice("widgets use content as the display view", 1.8); + $view = "widgets/$widget->handler/view"; + } echo elgg_view($view, array('entity' => $widget)); } } else { |