diff options
27 files changed, 229 insertions, 158 deletions
diff --git a/actions/admin/user/delete.php b/actions/admin/user/delete.php index c22d27e8a..61dbc7e10 100644 --- a/actions/admin/user/delete.php +++ b/actions/admin/user/delete.php @@ -9,16 +9,19 @@ */ -// block non-admin users +// block non-admin users - require since this action is not registered admin_gatekeeper(); // Get the user $guid = get_input('guid'); $obj = get_entity($guid); +$name = $obj->name; +$username = $obj->username; + if (($obj instanceof ElggUser) && ($obj->canEdit())) { if ($obj->delete()) { - system_message(elgg_echo('admin:user:delete:yes')); + system_message(sprintf(elgg_echo('admin:user:delete:yes'), $name)); } else { register_error(elgg_echo('admin:user:delete:no')); } @@ -26,5 +29,10 @@ if (($obj instanceof ElggUser) && ($obj->canEdit())) { register_error(elgg_echo('admin:user:delete:no')); } -forward($_SERVER['HTTP_REFERER']); -exit; +// forward to user administration if on a user's page as it no longer exists +$forward = REFERER; +if (strpos($_SERVER['HTTP_REFERER'], $username) != FALSE) { + $forward = "pg/admin/user/"; +} + +forward($forward); diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 3d08227e4..1d52c0534 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1624,7 +1624,7 @@ function is_not_null($string) { function elgg_normalise_plural_options_array($options, $singulars) { foreach ($singulars as $singular) { $plural = $singular . 's'; - + if (array_key_exists($singular, $options)) { if ($options[$singular] === ELGG_ENTITIES_ANY_VALUE) { $options[$plural] = $options[$singular]; @@ -1632,7 +1632,7 @@ function elgg_normalise_plural_options_array($options, $singulars) { $options[$plural] = array($options[$singular]); } } - + unset($options[$singular]); } @@ -2167,6 +2167,12 @@ function __elgg_shutdown_hook() { function elgg_init() { global $CONFIG; + // Actions + register_action('comments/add'); + register_action('comments/delete'); + register_action('likes/add'); + register_action('likes/delete'); + // Page handler for JS register_page_handler('js','js_page_handler'); @@ -2181,44 +2187,12 @@ function elgg_walled_garden_index() { $login = elgg_view('account/forms/login_walled_garden'); page_draw('', $login, 'page_shells/walled_garden'); - + // @hack Index must exit to keep plugins from continuing to extend exit; } /** - * Boot Elgg - * @return unknown_type - */ -function elgg_boot() { - global $CONFIG; - - // Actions - register_action('comments/add'); - register_action('comments/delete'); - register_action('likes/add'); - register_action('likes/delete'); - - elgg_view_register_simplecache('css'); - elgg_view_register_simplecache('js/friendsPickerv1'); - elgg_view_register_simplecache('js/initialise_elgg'); - - // discover the built-in view types - // @todo cache this - $view_path = $CONFIG->viewpath; - $CONFIG->view_types = array(); - - $views = scandir($view_path); - - foreach ($views as $view) { - if ('.' !== substr($view, 0, 1) && is_dir($view_path . $view)) { - $CONFIG->view_types[] = $view; - } - } - -} - -/** * Runs unit tests for the API. */ function elgg_api_test($hook, $type, $value, $params) { @@ -2420,7 +2394,7 @@ function elgg_get_array_value($key, array $array, $default = NULL) { */ function elgg_sort_3d_array_by_value(&$array, $element, $sort_order = SORT_ASC, $sort_type = SORT_LOCALE_STRING) { $sort = array(); - + foreach ($array as $k => $v) { if (isset($v[$element])) { $sort[] = strtolower($v[$element]); @@ -2428,7 +2402,7 @@ function elgg_sort_3d_array_by_value(&$array, $element, $sort_order = SORT_ASC, $sort[] = NULL; } }; - + return array_multisort($sort, $sort_order, $sort_type, $array); } @@ -2454,7 +2428,6 @@ define('REFERRER', -1); define('REFERER', -1); register_elgg_event_handler('init', 'system', 'elgg_init'); -register_elgg_event_handler('boot', 'system', 'elgg_boot', 1000); register_plugin_hook('unit_test', 'system', 'elgg_api_test'); register_elgg_event_handler('init', 'system', 'add_custom_menu_items', 1000); diff --git a/engine/lib/entities.php b/engine/lib/entities.php index c34aea550..b684ae822 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -300,7 +300,7 @@ abstract class ElggEntity implements * @param string $name Name of the metadata * @param mixed $value Value of the metadata * @param string $value_type Types supported: integer and string. Will auto-identify if not set - * @param bool $multiple + * @param bool $multiple (does not support associative arrays) * @return bool */ public function setMetaData($name, $value, $value_type = "", $multiple = false) { diff --git a/engine/lib/filestore.php b/engine/lib/filestore.php index d131154c6..4e92fee21 100644 --- a/engine/lib/filestore.php +++ b/engine/lib/filestore.php @@ -663,17 +663,20 @@ class ElggFile extends ElggObject { } } - // If parameters loaded then create new filestore - if (count($parameters)!=0) { - // Create new filestore object - if ((!isset($parameters['filestore'])) || (!class_exists($parameters['filestore']))) { - throw new ClassNotFoundException(elgg_echo('ClassNotFoundException:NotFoundNotSavedWithFile')); + if (isset($parameters['filestore'])) { + if (!class_exists($parameters['filestore'])) { + $msg = sprintf(elgg_echo('ClassNotFoundException:NotFoundNotSavedWithFile'), + $parameters['filestore'], + $this->guid); + throw new ClassNotFoundException($msg); } + // Create new filestore object $this->filestore = new $parameters['filestore'](); - // Set parameters $this->filestore->setParameters($parameters); + } else { + // @todo - should we log error if filestore not set } @@ -756,7 +759,6 @@ function get_resized_image_from_uploaded_file($input_name, $maxwidth, $maxheight if (isset($_FILES[$input_name]) && $_FILES[$input_name]['error'] == 0) { return get_resized_image_from_existing_file($_FILES[$input_name]['tmp_name'], $maxwidth, $maxheight, $square); } - return false; } @@ -786,11 +788,9 @@ function get_resized_image_from_existing_file($input_name, $maxwidth, $maxheight return FALSE; } - // Get width and height $width = $imgsizearray[0]; $height = $imgsizearray[1]; - // make sure we can read the image $accepted_formats = array( 'image/jpeg' => 'jpeg', 'image/pjpeg' => 'jpeg', @@ -805,6 +805,87 @@ function get_resized_image_from_existing_file($input_name, $maxwidth, $maxheight return FALSE; } + // get the parameters for resizing the image + $options = array( + 'maxwidth' => $maxwidth, + 'maxheight' => $maxheight, + 'square' => $square, + 'upscale' => $upscale, + 'x1' => $x1, + 'y1' => $y1, + 'x2' => $x2, + 'y2' => $y2, + ); + $params = get_image_resize_parameters($width, $height, $options); + if ($params == FALSE) { + return FALSE; + } + + // load original image + $original_image = $load_function($input_name); + if (!$original_image) { + return FALSE; + } + + // allocate the new image + $new_image = imagecreatetruecolor($params['newwidth'], $params['newheight']); + if (!$new_image) { + return FALSE; + } + + $rtn_code = imagecopyresampled( $new_image, + $original_image, + 0, + 0, + $params['xoffset'], + $params['yoffset'], + $params['newwidth'], + $params['newheight'], + $params['selectionwidth'], + $params['selectionheight']); + if (!$rtn_code) { + return FALSE; + } + + // grab a compressed jpeg version of the image + ob_start(); + imagejpeg($new_image, NULL, 90); + $jpeg = ob_get_clean(); + + imagedestroy($new_image); + imagedestroy($original_image); + + return $jpeg; +} + +/** + * Calculate the parameters for resizing an image + * + * @param int $width Width of the original image + * @param int $height Height of the original image + * @param array $options See $defaults for the options + * @return array or FALSE + * @since 1.7.2 + */ +function get_image_resize_parameters($width, $height, $options) { + + $defaults = array( + 'maxwidth' => 100, + 'maxheight' => 100, + + 'square' => FALSE, + 'upscale' => FALSE, + + 'x1' => 0, + 'y1' => 0, + 'x2' => 0, + 'y2' => 0, + ); + + $options = array_merge($defaults, $options); + + extract($options); + // crop image first? $crop = TRUE; if ($x1 == 0 && $y1 == 0 && $x2 == 0 && $y2 == 0) { @@ -813,12 +894,12 @@ function get_resized_image_from_existing_file($input_name, $maxwidth, $maxheight // how large a section of the image has been selected if ($crop) { - $region_width = $x2 - $x1; - $region_height = $y2 - $y1; + $selection_width = $x2 - $x1; + $selection_height = $y2 - $y1; } else { // everything selected if no crop parameters - $region_width = $width; - $region_height = $height; + $selection_width = $width; + $selection_height = $height; } // determine cropping offsets @@ -826,7 +907,7 @@ function get_resized_image_from_existing_file($input_name, $maxwidth, $maxheight // asking for a square image back // detect case where someone is passing crop parameters that are not for a square - if ($crop == TRUE && $region_width != $region_height) { + if ($crop == TRUE && $selection_width != $selection_height) { return FALSE; } @@ -834,7 +915,7 @@ function get_resized_image_from_existing_file($input_name, $maxwidth, $maxheight $new_width = $new_height = min($maxwidth, $maxheight); // find largest square that fits within the selected region - $region_width = $region_height = min($region_width, $region_height); + $selection_width = $selection_height = min($selection_width, $selection_height); // set offsets for crop if ($crop) { @@ -844,20 +925,19 @@ function get_resized_image_from_existing_file($input_name, $maxwidth, $maxheight $height = $width; } else { // place square region in the center - $widthoffset = floor(($width - $region_width) / 2); - $heightoffset = floor(($height - $region_height) / 2); + $widthoffset = floor(($width - $selection_width) / 2); + $heightoffset = floor(($height - $selection_height) / 2); } } else { // non-square new image - $new_width = $maxwidth; $new_height = $maxwidth; // maintain aspect ratio of original image/crop - if (($region_height / (float)$new_height) > ($region_width / (float)$new_width)) { - $new_width = floor($new_height * $region_width / (float)$region_height); + if (($selection_height / (float)$new_height) > ($selection_width / (float)$new_width)) { + $new_width = floor($new_height * $selection_width / (float)$selection_height); } else { - $new_height = floor($new_width * $region_height / (float)$region_width); + $new_height = floor($new_width * $selection_height / (float)$selection_width); } // by default, use entire image @@ -888,48 +968,22 @@ function get_resized_image_from_existing_file($input_name, $maxwidth, $maxheight } elseif ($width < $new_width) { $ratio = $new_height / $height; } - $region_height = $height; - $region_width = $width; + $selection_height = $height; + $selection_width = $width; $new_height = floor($height * $ratio); $new_width = floor($width * $ratio); } - // load original image - $orig_image = $load_function($input_name); - if (!$orig_image) { - return FALSE; - } - - // allocate the new image - $newimage = imagecreatetruecolor($new_width, $new_height); - if (!$newimage) { - return FALSE; - } - - // create the new image - $rtn_code = imagecopyresampled( $newimage, - $orig_image, - 0, - 0, - $widthoffset, - $heightoffset, - $new_width, - $new_height, - $region_width, - $region_height ); - if (!$rtn_code) { - return FALSE; - } - - // grab contents for return - ob_start(); - imagejpeg($newimage, null, 90); - $jpeg = ob_get_clean(); - - imagedestroy($newimage); - imagedestroy($orig_image); + $params = array( + 'newwidth' => $new_width, + 'newheight' => $new_height, + 'selectionwidth' => $selection_width, + 'selectionheight' => $selection_height, + 'xoffset' => $widthoffset, + 'yoffset' => $heightoffset, + ); - return $jpeg; + return $params; } diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 3ad774ad2..4d489178f 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -183,9 +183,12 @@ function remove_metadata($entity_guid, $name, $value = "") { /** * Create a new metadata object, or update an existing one. * + * Metadata can be an array by setting allow_multiple to TRUE, but it is an + * indexed array with no control over the indexing. + * * @param int $entity_guid The entity to attach the metadata to * @param string $name Name of the metadata - * @param string $value Value of the metadata (cannot be associative array) + * @param string $value Value of the metadata * @param string $value_type 'text', 'integer', or '' for automatic detection * @param int $owner_guid GUID of entity that owns the metadata * @param int $access_id Default is ACCESS_PRIVATE @@ -343,8 +346,12 @@ function update_metadata($id, $name, $value, $value_type, $owner_guid, $access_i /** * This function creates metadata from an associative array of "key => value" pairs. * + * To achieve an array for a single key, pass in the same key multiple times with + * allow_multiple set to TRUE. This creates an indexed array. It does not support + * associative arrays and there is no guarantee on the ordering in the array. + * * @param int $entity_guid The entity to attach the metadata to - * @param string $name_and_values Associative array + * @param string $name_and_values Associative array - a value can be a string, number, bool * @param string $value_type 'text', 'integer', or '' for automatic detection * @param int $owner_guid GUID of entity that owns the metadata * @param int $access_id Default is ACCESS_PRIVATE diff --git a/engine/lib/output.php b/engine/lib/output.php index 3280517b0..3d08f2a28 100644 --- a/engine/lib/output.php +++ b/engine/lib/output.php @@ -97,7 +97,7 @@ function autop($pee, $br = 1) { * @return string * @since 1.7.2 */ -function elgg_make_excerpt($text, $num_chars = 250) { +function elgg_get_excerpt($text, $num_chars = 250) { $text = trim(elgg_strip_tags($text)); $string_length = elgg_strlen($text); @@ -148,12 +148,19 @@ function friendly_title($title) { /** * When given a title, returns a version suitable for inclusion in a URL * - * @todo add plugin hook so that developers can provide their own friendly title * @param string $title The title * @return string The optimised title * @since 1.7.2 */ function elgg_get_friendly_title($title) { + + // return a URL friendly title to short circuit normal title formatting + $params = array('title' => $title); + $result = trigger_plugin_hook('format', 'friendly:title', $params, NULL); + if ($result) { + return $result; + } + //$title = iconv('UTF-8', 'ASCII//TRANSLIT', $title); $title = preg_replace("/[^\w ]/","",$title); $title = str_replace(" ","-",$title); @@ -176,14 +183,21 @@ function friendly_time($time) { } /** - * Displays a UNIX timestamp in a friendly way (eg "less than a minute ago") + * Formats a UNIX timestamp in a friendly way (eg "less than a minute ago") * - * @todo add plugin hook so that developers can provide their own friendly time * @param int $time A UNIX epoch timestamp - * @return string The friendly time + * @return string The friendly time string * @since 1.7.2 */ function elgg_get_friendly_time($time) { + + // return a time string to short circuit normal time formatting + $params = array('time' => $time); + $result = trigger_plugin_hook('format', 'friendly:time', $params, NULL); + if ($result) { + return $result; + } + $diff = time() - (int)$time; $minute = 60; diff --git a/engine/lib/version.php b/engine/lib/version.php index 5322e5afa..011fdaa7b 100644 --- a/engine/lib/version.php +++ b/engine/lib/version.php @@ -103,6 +103,9 @@ function version_upgrade_check() { * */ function version_upgrade() { + // It's possible large upgrades could exceed the max execution time. + set_time_limit(0); + $dbversion = (int) datalist_get('version'); // No version number? Oh snap...this is an upgrade from a clean installation < 1.7. diff --git a/engine/lib/views.php b/engine/lib/views.php index d946e159d..68ddf49e1 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1062,4 +1062,32 @@ function elgg_is_valid_view_type($view_type) { global $CONFIG; return in_array($view_type, $CONFIG->view_types); -}
\ No newline at end of file +} + + +/** + * Initialize viewtypes on system boot event + * This ensures simplecache is cleared during upgrades. See #2252 + */ +function elgg_views_boot() { + global $CONFIG; + + elgg_view_register_simplecache('css'); + elgg_view_register_simplecache('js/friendsPickerv1'); + elgg_view_register_simplecache('js/initialise_elgg'); + + // discover the built-in view types + // @todo cache this + $view_path = $CONFIG->viewpath; + $CONFIG->view_types = array(); + + $views = scandir($view_path); + + foreach ($views as $view) { + if ('.' !== substr($view, 0, 1) && is_dir($view_path . $view)) { + $CONFIG->view_types[] = $view; + } + } +} + +register_elgg_event_handler('boot', 'system', 'elgg_views_boot', 1000); diff --git a/htaccess_dist b/htaccess_dist index 7001610c0..a2c4dac8b 100644 --- a/htaccess_dist +++ b/htaccess_dist @@ -3,13 +3,6 @@ # License http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 # Link http://elgg.org/ -<IfModule !mod_rewrite.c> - # ugly ugly hack to detect missing mod_rewrite - # RedirectMatch must be to an absolute destination, so forces 500 error... - ErrorDocument 500 "Elgg error: Apache does not have mod_rewrite loaded. Please check your Apache setup." - RedirectMatch 302 .* index.php -</IfModule> - <Files "htaccess_dist"> order allow,deny deny from all @@ -30,18 +23,6 @@ DirectoryIndex index.php ExpiresDefault "access plus 10 years" </IfModule> -# php 4, apache 1.x -<IfModule mod_php4.c> - ErrorDocument 500 "Elgg error: Elgg does not support PHP 4." - RedirectMatch 302 .* index.php -</IfModule> - -# php 4, apache 2 -<IfModule sapi_apache2.c> - ErrorDocument 500 "Elgg error: Elgg does not support PHP 4." - RedirectMatch 302 .* index.php -</IfModule> - # php 5, apache 1 and 2 <IfModule mod_php5.c> # default memory limit to 64Mb diff --git a/languages/en.php b/languages/en.php index a808492c2..743ac6eaf 100644 --- a/languages/en.php +++ b/languages/en.php @@ -97,7 +97,7 @@ $english = array( 'InvalidParameterException:MissingOwner' => "File %s (file guid:%d) (owner guid:%d) is missing an owner!", 'IOException:CouldNotMake' => "Could not make %s", 'IOException:MissingFileName' => "You must specify a name before opening a file.", - 'ClassNotFoundException:NotFoundNotSavedWithFile' => "Filestore not found or class not saved with file!", + 'ClassNotFoundException:NotFoundNotSavedWithFile' => "Unable to load filestore class %s for file %u", 'NotificationException:NoNotificationMethod' => "No notification method specified.", 'NotificationException:NoHandlerFound' => "No handler found for '%s' or it was not callable.", 'NotificationException:ErrorNotifyingGuid' => "There was an error while notifying %d", @@ -525,7 +525,7 @@ To remove a widget drag it back to the <b>Widget gallery</b>.", 'admin:user:unban:no' => "Can not unban user", 'admin:user:unban:yes' => "User un-banned.", 'admin:user:delete:no' => "Can not delete user", - 'admin:user:delete:yes' => "User deleted", + 'admin:user:delete:yes' => "The user %s has been deleted", 'admin:user:resetpassword:yes' => "Password reset, user notified.", 'admin:user:resetpassword:no' => "Password could not be reset.", diff --git a/mod/blog/actions/blog/auto_save_revision.php b/mod/blog/actions/blog/auto_save_revision.php index 00b24acce..9d5fe3ea7 100644 --- a/mod/blog/actions/blog/auto_save_revision.php +++ b/mod/blog/actions/blog/auto_save_revision.php @@ -41,7 +41,7 @@ if ($title && $description) { $blog->access_id = ACCESS_PRIVATE; $blog->title = $title; $blog->description = $description; - $blog->excerpt = elgg_make_excerpt($excerpt); + $blog->excerpt = elgg_get_excerpt($excerpt); // must be present or doesn't show up when metadata sorting. $blog->publish_date = time(); diff --git a/mod/blog/actions/blog/delete.php b/mod/blog/actions/blog/delete.php index 8fa1ff889..ee8621257 100644 --- a/mod/blog/actions/blog/delete.php +++ b/mod/blog/actions/blog/delete.php @@ -13,8 +13,10 @@ $blog_guid = get_input('guid'); $blog = get_entity($blog_guid); if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { + $container = get_entity($blog->container_guid); if ($blog->delete()) { system_message(elgg_echo('blog:message:deleted_post')); + forward("pg/blog/$container->username/read/"); } else { register_error(elgg_echo('blog:error:cannot_delete_post')); } diff --git a/mod/blog/actions/blog/save.php b/mod/blog/actions/blog/save.php index 2647e7b9a..9b1d04965 100644 --- a/mod/blog/actions/blog/save.php +++ b/mod/blog/actions/blog/save.php @@ -78,9 +78,9 @@ foreach ($values as $name => $default) { case 'excerpt': if ($value) { - $value = elgg_make_excerpt($value); + $value = elgg_get_excerpt($value); } else { - $value = elgg_make_excerpt($values['description']); + $value = elgg_get_excerpt($values['description']); } $values[$name] = $value; break; diff --git a/mod/bookmarks/actions/delete.php b/mod/bookmarks/actions/delete.php index 5a35d44f5..e99c6604d 100644 --- a/mod/bookmarks/actions/delete.php +++ b/mod/bookmarks/actions/delete.php @@ -1,7 +1,7 @@ <?php /** * Elgg bookmarks delete action - * + * * @package ElggBookmarks * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Curverider <info@elgg.com> @@ -12,12 +12,13 @@ $guid = get_input('bookmark_guid',0); if ($entity = get_entity($guid)) { if ($entity->canEdit()) { + $container = get_entity($entity->container_guid); if ($entity->delete()) { system_message(elgg_echo("bookmarks:delete:success")); - forward($_SERVER['HTTP_REFERER']); + forward("pg/bookmarks/$container->username/"); } } } - + register_error(elgg_echo("bookmarks:delete:failed")); forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file diff --git a/mod/embed/views/default/embed/item/gallery.php b/mod/embed/views/default/embed/item/gallery.php index 09cab3cef..52c0966fa 100644 --- a/mod/embed/views/default/embed/item/gallery.php +++ b/mod/embed/views/default/embed/item/gallery.php @@ -23,7 +23,7 @@ $icon_size = $vars['icon_size']; // different entity types have different title attribute names. $title = isset($item->name) ? $item->name : $item->title; // don't let it be too long -$title = elgg_make_excerpt($title); +$title = elgg_get_excerpt($title); // @todo you can disable plugins that are required by other plugins // (embed requires ecml) so fallback to a hard-coded check to see if ecml is enabled. diff --git a/mod/embed/views/default/embed/item/list.php b/mod/embed/views/default/embed/item/list.php index c45b42e19..8cc60753c 100644 --- a/mod/embed/views/default/embed/item/list.php +++ b/mod/embed/views/default/embed/item/list.php @@ -21,7 +21,7 @@ $icon_size = $vars['icon_size']; // different entity types have different title attribute names. $title = isset($item->name) ? $item->name : $item->title; // don't let it be too long -$title = elgg_make_excerpt($title); +$title = elgg_get_excerpt($title); // @todo you can disable plugins that are required by other plugins // (embed requires ecml) so fallback to a hard-coded check to see if ecml is enabled. diff --git a/mod/file/actions/delete.php b/mod/file/actions/delete.php index ee6dab91e..7e826278c 100644 --- a/mod/file/actions/delete.php +++ b/mod/file/actions/delete.php @@ -63,6 +63,6 @@ } - forward("pg/file/" . $_SESSION['user']->username); + forward("pg/file/$container->username/"); ?>
\ No newline at end of file diff --git a/mod/groups/views/default/river/forum/create.php b/mod/groups/views/default/river/forum/create.php index 7fc3affe7..9895fac85 100644 --- a/mod/groups/views/default/river/forum/create.php +++ b/mod/groups/views/default/river/forum/create.php @@ -20,7 +20,7 @@ $string .= elgg_view('likes/forms/link', array('entity' => $object)); $string .= "</span>"; $string .= "<div class=\"river_content_display\">"; - $string .= elgg_make_excerpt($contents, 200); + $string .= elgg_get_excerpt($contents, 200); $string .= "</div>"; echo $string; diff --git a/mod/groups/views/default/river/forum/topic/create.php b/mod/groups/views/default/river/forum/topic/create.php index 0d70ad718..09b2a3483 100644 --- a/mod/groups/views/default/river/forum/topic/create.php +++ b/mod/groups/views/default/river/forum/topic/create.php @@ -23,7 +23,7 @@ } $string .= "</span>"; $string .= "<div class=\"river_content_display\">"; - $string .= elgg_make_excerpt($contents, 200); + $string .= elgg_get_excerpt($contents, 200); $string .= "</div>"; echo $string;
\ No newline at end of file diff --git a/mod/pages/actions/pages/delete.php b/mod/pages/actions/pages/delete.php index 1ce30472c..ab28e23b6 100644 --- a/mod/pages/actions/pages/delete.php +++ b/mod/pages/actions/pages/delete.php @@ -11,6 +11,8 @@ if ($page = get_entity($page)) { if ($page->canEdit()) { + $container = get_entity($page->container_guid); + // Bring all child elements forward $parent = $page->parent_guid; if ($children = elgg_get_entities_from_metadata(array('metadata_name' => 'parent_guid', 'metadata_value' => $page->getGUID()))) { @@ -23,11 +25,9 @@ if ($page = get_entity($page)) { if ($parent) { if ($parent = get_entity($parent)) { forward($parent->getURL()); - exit; } } - forward('pg/pages/owned/' . $_SESSION['user']->username); - exit; + forward("pg/pages/owned/$container->username/"); } } diff --git a/mod/pages/views/default/river/object/page/create.php b/mod/pages/views/default/river/object/page/create.php index 728978178..d182a1ebe 100644 --- a/mod/pages/views/default/river/object/page/create.php +++ b/mod/pages/views/default/river/object/page/create.php @@ -16,7 +16,7 @@ $string = sprintf(elgg_echo("pages:river:created"),$url) . " "; $string .= elgg_echo("pages:river:create") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a> <span class='entity_subtext'>". elgg_view_friendly_time($object->time_created) ."</span> <a class='river_comment_form_button link'>Comment</a>"; $string .= elgg_view('likes/forms/link', array('entity' => $object)); $string .= "<div class=\"river_content_display\">"; -$string .= elgg_make_excerpt($contents, 200); +$string .= elgg_get_excerpt($contents, 200); $string .= "</div>"; echo $string; diff --git a/mod/reportedcontent/views/default/admin/overview/reportedcontent.php b/mod/reportedcontent/views/default/admin/overview/reportedcontent.php index 4207aacd2..9828b10ff 100644 --- a/mod/reportedcontent/views/default/admin/overview/reportedcontent.php +++ b/mod/reportedcontent/views/default/admin/overview/reportedcontent.php @@ -9,9 +9,6 @@ * @link http://elgg.com/ */ -// Set admin user for user block -set_page_owner($_SESSION['guid']); - $title = elgg_view_title(elgg_echo('reportedcontent')); $reported = elgg_get_entities(array('types' => 'object', 'subtypes' => 'reported_content', 'limit' => 9999)); diff --git a/mod/riverdashboard/endpoint/get_comments.php b/mod/riverdashboard/endpoint/get_comments.php index 017591fa5..cc210b126 100644 --- a/mod/riverdashboard/endpoint/get_comments.php +++ b/mod/riverdashboard/endpoint/get_comments.php @@ -31,7 +31,7 @@ foreach ($comments as $comment) { echo "</span>"; //truncate comment to 150 characters and strip tags - $contents = elgg_make_excerpt($comment->value, 150); + $contents = elgg_get_excerpt($comment->value, 150); echo "<div class='river_comment_contents'>"; echo "<a href=\"{$comment_owner_url}\">" . $comment_owner->name . '</a> <span class="twitter_anywhere">' . parse_urls($contents) . '</span>'; diff --git a/mod/riverdashboard/views/default/river/item/wrapper.php b/mod/riverdashboard/views/default/river/item/wrapper.php index 2b964510d..6dd4e91d3 100644 --- a/mod/riverdashboard/views/default/river/item/wrapper.php +++ b/mod/riverdashboard/views/default/river/item/wrapper.php @@ -101,7 +101,7 @@ if ($comments){ echo "</span>"; //truncate comment to 150 characters and strip tags - $contents = elgg_make_excerpt($comment->value, 150); + $contents = elgg_get_excerpt($comment->value, 150); echo "<div class='river_comment_contents'>"; echo "<a href=\"{$comment_owner_url}\">" . $comment_owner->name . '</a> <span class="elgg_excerpt">' . parse_urls($contents) . '</span>'; diff --git a/views/default/input/checkboxes.php b/views/default/input/checkboxes.php index 088a97709..dfab90a0a 100644 --- a/views/default/input/checkboxes.php +++ b/views/default/input/checkboxes.php @@ -49,9 +49,8 @@ if ($options) { // ignores the label (because it's just the index) and sets the value ($option) // as the label. // Wow. - $labelint = (int) $label; - - if ("{$label}" == "{$labelint}") { + // @todo deprecate in Elgg 1.8 + if (is_integer($label)) { $label = $option; } diff --git a/views/default/input/radio.php b/views/default/input/radio.php index fe7335b8a..8520b2b83 100644 --- a/views/default/input/radio.php +++ b/views/default/input/radio.php @@ -30,11 +30,13 @@ foreach($vars['options'] as $label => $option) { } else { $selected = "checked = \"checked\""; } - $labelint = (int) $label; - if ("{$label}" == "{$labelint}") { + + // handle indexed array where label is not specified + // @todo deprecate in Elgg 1.8 + if (is_integer($label)) { $label = $option; } - + if (isset($vars['internalid'])) { $id = "id=\"{$vars['internalid']}\""; } diff --git a/views/failsafe/input/checkboxes.php b/views/failsafe/input/checkboxes.php index 0cc32958f..0792f09ce 100644 --- a/views/failsafe/input/checkboxes.php +++ b/views/failsafe/input/checkboxes.php @@ -35,8 +35,10 @@ foreach($vars['options'] as $label => $option) { $selected = "checked = \"checked\""; } } - $labelint = (int) $label; - if ("{$label}" == "{$labelint}") { + + // handle indexed array where label is not specified + // @todo deprecate in Elgg 1.8 + if (is_integer($label)) { $label = $option; } |