]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Merged r6620:6653 from 1.7 branch into trunk
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 22 Aug 2010 20:58:21 +0000 (20:58 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sun, 22 Aug 2010 20:58:21 +0000 (20:58 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@6846 36083f99-b078-4883-b0ff-0f9b5a30f544

27 files changed:
actions/admin/user/delete.php
engine/lib/elgglib.php
engine/lib/entities.php
engine/lib/filestore.php
engine/lib/metadata.php
engine/lib/output.php
engine/lib/version.php
engine/lib/views.php
htaccess_dist
languages/en.php
mod/blog/actions/blog/auto_save_revision.php
mod/blog/actions/blog/delete.php
mod/blog/actions/blog/save.php
mod/bookmarks/actions/delete.php
mod/embed/views/default/embed/item/gallery.php
mod/embed/views/default/embed/item/list.php
mod/file/actions/delete.php
mod/groups/views/default/river/forum/create.php
mod/groups/views/default/river/forum/topic/create.php
mod/pages/actions/pages/delete.php
mod/pages/views/default/river/object/page/create.php
mod/reportedcontent/views/default/admin/overview/reportedcontent.php
mod/riverdashboard/endpoint/get_comments.php
mod/riverdashboard/views/default/river/item/wrapper.php
views/default/input/checkboxes.php
views/default/input/radio.php
views/failsafe/input/checkboxes.php

index c22d27e8a876bb0a73a680a9e38f1ce491139549..61dbc7e10153b707e36a4afadd503f3219a2ad7d 100644 (file)
@@ -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);
index 3d08227e4e0a07f52a4b9768a6b869f615129541..1d52c05343e30b4ec683f1e9ca17812cdfee5f36 100644 (file)
@@ -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,43 +2187,11 @@ 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.
  */
@@ -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);
index c34aea5509b4751ca2e80237ce2e33acda3bd27a..b684ae822b0e7012ce0aa3902ddcc198f4ecb3b2 100644 (file)
@@ -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) {
index d131154c6698edf7e014e6e1e3c2fa8c583edf84..4e92fee21395b3def6bca69200d0040b32f4670e 100644 (file)
@@ -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;
 }
 
 
index 3ad774ad2a05272e6b9aade8c346d3f50254851f..4d489178f4c0c0d1e18d9abb691b5b445d7e6f05 100644 (file)
@@ -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
index 3280517b0bba216fd548da42ad20598233ab9a2a..3d08f2a2846adc78eeb58552b30cf71639521b86 100644 (file)
@@ -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;
index 5322e5afad9e76503c5c973a3345d76e061bbffd..011fdaa7b25d57872455d03e30696cd824e0c2e3 100644 (file)
@@ -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.
index d946e159d7bdeb6e88426a4cc29b0209e8b6f989..68ddf49e1ca0ca25cba39c518f5bd07130731f73 100644 (file)
@@ -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);
index 7001610c02d8152c67fa36d577fd890dd065ffac..a2c4dac8bc36d1401a54ed40eb965681a99f146e 100644 (file)
@@ -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
index a808492c26d1f6ab06d756a50be162876453481e..743ac6eafe9c637b48f4876d74fe3d393b6b55bd 100644 (file)
@@ -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.",
index 00b24acce36a3a646b0968fa1d8082c35b4ee72c..9d5fe3ea7fd7fe747d31cc59fe72e40176f3092b 100644 (file)
@@ -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();
 
index 8fa1ff88998f70d6e7c2ce9320222616f958f54e..ee8621257dc031faab3b4f7c099cb52aabe75a00 100644 (file)
@@ -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'));
        }
index 2647e7b9a62e8b3ddda655b17aeb2b42b9189771..9b1d04965ee54258e78ab105e692ea01291d790e 100644 (file)
@@ -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;
index 5a35d44f5983c5fe326a161046b1cb9fea711fb1..e99c6604dd2d03a56acdd2bb5766cb4a05c7bff0 100644 (file)
@@ -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>
 $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
index 09cab3cefc694929efd8bf99a1e53cb947e7ff92..52c0966fa4e7a3844aa24731699e82e614dcb898 100644 (file)
@@ -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.
index c45b42e199d911c7ef04f0d84706522fdebf3dc9..8cc60753cf0e065b9f0ce028d04274cd0481b2fa 100644 (file)
@@ -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.
index ee6dab91e6e921047848beef2bb59409f3357ba0..7e826278cdc97bf4425f45f681abbd73b46fe906 100644 (file)
@@ -63,6 +63,6 @@
                        
                }
                
-               forward("pg/file/" . $_SESSION['user']->username);
+               forward("pg/file/$container->username/");
 
 ?>
\ No newline at end of file
index 7fc3affe7493b21d572d3c76d048924e289f3e45..9895fac85eaaafc20181b60941a4740cc4513f34 100644 (file)
@@ -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;
index 0d70ad718681c1e2650d55bf46203595d88a3a59..09b2a34832cae67b94b64637df1601b2271f44c1 100644 (file)
@@ -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
index 1ce30472c1865b9777d4d17f9e291d6ac2d83d5d..ab28e23b63ca4efd5a2e808c720c4484a803d0f6 100644 (file)
@@ -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/");
                        }
 
        }
index 7289781784164f377c7292c4bd10417958557818..d182a1ebe32369ebc0c330a5e934b8a48e674587 100644 (file)
@@ -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;
index 4207aacd2f0b7bf1465b56314781d60b77dd5122..9828b10ff5c30e197d76e78a4506db957b43a0eb 100644 (file)
@@ -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));
index 017591fa57a61b21cc875b118bc57a135a7720ae..cc210b126c1a7d5fa53e90589a25e440e00ff804 100644 (file)
@@ -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>&nbsp;<span class="twitter_anywhere">' . parse_urls($contents) . '</span>';
index 2b964510db974075e7d5b791cb06e89ca07086fa..6dd4e91d3fe96e9680c45a5cad34a2799c70a709 100644 (file)
@@ -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>&nbsp;<span class="elgg_excerpt">' . parse_urls($contents) . '</span>';
index 088a97709dd83dea81b0cf3e6d193337bc2c0112..dfab90a0a5a52be0a2b79969e6af04c30dab2301 100644 (file)
@@ -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;
                }
 
index fe7335b8a6c6c7577e22f1fcc377debf3ea396d8..8520b2b8317fafe7c646103b5461f8f4c74cb464 100644 (file)
@@ -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']}\"";
        }
index 0cc32958f44c91506fc741add5303cfecf3650d0..0792f09cedaff759cd22f38156200b3a5ae75e19 100644 (file)
@@ -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;
        }