diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2011-04-18 19:54:17 -0400 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2011-04-18 19:54:17 -0400 |
commit | 0d9c5c1ccd66018a819b4ca327ab203f473e35dc (patch) | |
tree | f55e5caa8bf8036b02fc553eecd2b615791d2ce5 /engine/lib | |
parent | ca63a6b81eee1dfbee99a393a790402475a4612c (diff) | |
parent | d928588805375e7190ab393e2def555b39701a27 (diff) | |
download | elgg-0d9c5c1ccd66018a819b4ca327ab203f473e35dc.tar.gz elgg-0d9c5c1ccd66018a819b4ca327ab203f473e35dc.tar.bz2 |
Merge branch 'master' of github.com:Elgg/Elgg
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/cache.php | 6 | ||||
-rw-r--r-- | engine/lib/database.php | 21 | ||||
-rw-r--r-- | engine/lib/entities.php | 2 | ||||
-rw-r--r-- | engine/lib/metastrings.php | 4 | ||||
-rw-r--r-- | engine/lib/navigation.php | 11 | ||||
-rw-r--r-- | engine/lib/river.php | 4 |
6 files changed, 33 insertions, 15 deletions
diff --git a/engine/lib/cache.php b/engine/lib/cache.php index 8529ae7fa..11c95e78a 100644 --- a/engine/lib/cache.php +++ b/engine/lib/cache.php @@ -163,13 +163,15 @@ function elgg_register_simplecache_view($viewname) { function elgg_get_simplecache_url($type, $view) { global $CONFIG; $lastcache = (int)$CONFIG->lastcache; - + $viewtype = elgg_get_viewtype(); if (elgg_is_simplecache_enabled()) { - $viewtype = elgg_get_viewtype(); $url = elgg_get_site_url() . "cache/$type/$viewtype/$view.$lastcache.$type"; } else { $url = elgg_get_site_url() . "$type/$view.$lastcache.$type"; + $elements = array("view" => $viewtype); + $url = elgg_http_add_url_query_elements($url, $elements); } + return $url; } diff --git a/engine/lib/database.php b/engine/lib/database.php index a9c4017a0..6b1b494b9 100644 --- a/engine/lib/database.php +++ b/engine/lib/database.php @@ -680,22 +680,31 @@ function sanitize_string($string) { * Sanitises an integer for database use. * * @param int $int Integer - * + * @param bool[optional] $signed Whether negative values should be allowed (true) * @return int Sanitised integer */ -function sanitise_int($int) { +function sanitise_int($int, $signed = true) { + $int = (int) $int; + + if ($signed === false) { + if ($int < 0) { + $int = 0; + } + } + return (int) $int; } /** - * Wrapper function for alternate English spelling + * Sanitises an integer for database use. + * Wrapper function for alternate English spelling (@see sanitise_int) * * @param int $int Integer - * + * @param bool[optional] $signed Whether negative values should be allowed (true) * @return int Sanitised integer */ -function sanitize_int($int) { - return (int) $int; +function sanitize_int($int, $signed = true) { + return sanitise_int($int, $signed); } /** diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 685c68a5b..cb197b569 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -922,7 +922,7 @@ function elgg_get_entities(array $options = array()) { if ($options['limit']) { $limit = sanitise_int($options['limit']); - $offset = sanitise_int($options['offset']); + $offset = sanitise_int($options['offset'], false); $query .= " LIMIT $offset, $limit"; } diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php index 796655569..983716925 100644 --- a/engine/lib/metastrings.php +++ b/engine/lib/metastrings.php @@ -322,7 +322,7 @@ function elgg_get_metastring_based_objects($options) { 'metastring_owner_guid', 'metastring_id', 'select', 'where', 'join' ); - + $options = elgg_normalise_plural_options_array($options, $singulars); if (!$options) { @@ -463,7 +463,7 @@ function elgg_get_metastring_based_objects($options) { if ($options['limit']) { $limit = sanitise_int($options['limit']); - $offset = sanitise_int($options['offset']); + $offset = sanitise_int($options['offset'], false); $query .= " LIMIT $offset, $limit"; } diff --git a/engine/lib/navigation.php b/engine/lib/navigation.php index 953bbe59a..b51c63b49 100644 --- a/engine/lib/navigation.php +++ b/engine/lib/navigation.php @@ -61,12 +61,19 @@ * @param mixed $menu_item A ElggMenuItem object or an array of options in format: * name => STR Menu item identifier (required) * text => STR Menu item display text (required) - * href => STR Menu item URL (required) (false for non-links) + * href => STR Menu item URL (required) (false for non-links. + * @warning If you disable the href the <a> tag will + * not appear, so the link_class will not apply. If you + * put <a> tags in manually through the 'text' option + * the default CSS selector .elgg-menu-$menu > li > a + * may affect formatting. Wrap in a <span> if it does.) * contexts => ARR Page context strings * section => STR Menu section identifier * title => STR Menu item tooltip * selected => BOOL Is this menu item currently selected * parent_name => STR Identifier of the parent menu item + * link_class => STR A class or classes for the <a> tag + * item_class => STR A class or classes for the <li> tag * * Custom options can be added as key value pairs. * @@ -269,7 +276,7 @@ function elgg_river_menu_setup($hook, $type, $return, $params) { 'href' => "#comments-add-$object->guid", 'text' => elgg_view_icon('speech-bubble'), 'title' => elgg_echo('comment:this'), - 'class' => "elgg-toggler", + 'link_class' => "elgg-toggler", 'priority' => 50, ); $return[] = ElggMenuItem::factory($options); diff --git a/engine/lib/river.php b/engine/lib/river.php index 55d1c783a..80f285e50 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -302,7 +302,7 @@ function elgg_get_river(array $options = array()) { if ($options['limit']) { $limit = sanitise_int($options['limit']); - $offset = sanitise_int($options['offset']); + $offset = sanitise_int($options['offset'], false); $query .= " LIMIT $offset, $limit"; } @@ -375,7 +375,7 @@ function elgg_row_to_elgg_river_item($row) { function elgg_river_get_access_sql() { // rewrite default access where clause to work with river table return str_replace("and enabled='yes'", '', - str_replace('owner_guid', 'rv.subject_guid', + str_replace('owner_guid', 'rv.subject_guid', str_replace('access_id', 'rv.access_id', get_access_sql_suffix()))); } |