diff options
-rw-r--r-- | engine/lib/entities.php | 5 | ||||
-rw-r--r-- | engine/lib/input.php | 6 | ||||
-rw-r--r-- | engine/schema/mysql.sql | 2 | ||||
-rw-r--r-- | mod/htmlawed/start.php | 15 | ||||
-rw-r--r-- | mod/messages/views/default/messages/css.php | 9 | ||||
-rw-r--r-- | mod/notifications/views/default/notifications/subscriptions/forminternals.php | 3 | ||||
-rw-r--r-- | mod/profile/actions/edit.php | 14 | ||||
-rw-r--r-- | mod/search/languages/en.php | 1 | ||||
-rw-r--r-- | mod/search/search_hooks.php | 2 | ||||
-rw-r--r-- | mod/search/views/default/search/css.php | 11 | ||||
-rw-r--r-- | mod/search/views/default/search/entity.php | 79 | ||||
-rw-r--r-- | mod/search/views/rss/search/comments/entity.php | 53 | ||||
-rw-r--r-- | views/default/account/forms/register.php | 6 | ||||
-rw-r--r-- | views/default/friends/picker.php | 2 | ||||
-rw-r--r-- | views/default/output/friendlytitle.php | 7 |
15 files changed, 161 insertions, 54 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 987328adc..88cf3e3a7 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1969,9 +1969,8 @@ $count = false, $site_guid = 0, $container_guid = null, $timelower = 0, $timeupp $options['order_by'] = $order_by; } - if ($limit) { - $options['limit'] = $limit; - } + // need to pass 0 for all option + $options['limit'] = $limit; if ($offset) { $options['offset'] = $offset; diff --git a/engine/lib/input.php b/engine/lib/input.php index e21c909fc..26416d646 100644 --- a/engine/lib/input.php +++ b/engine/lib/input.php @@ -77,8 +77,10 @@ function set_input($variable, $value) { /** * Filter tags from a given string based on registered hooks. - * @param $var - * @return mixed The filtered result + * + * @param mixed $var Anything that does not include an object (strings, ints, arrays) + * This includes multi-dimensional arrays. + * @return mixed The filtered result - everything will be strings */ function filter_tags($var) { return trigger_plugin_hook('validate', 'input', null, $var); diff --git a/engine/schema/mysql.sql b/engine/schema/mysql.sql index 56c2a4077..23e81f39d 100644 --- a/engine/schema/mysql.sql +++ b/engine/schema/mysql.sql @@ -407,6 +407,7 @@ CREATE TABLE `prefix_users_entity` ( `language` varchar(6) NOT NULL DEFAULT '', `code` varchar(32) NOT NULL DEFAULT '', `banned` enum('yes','no') NOT NULL DEFAULT 'no', + `admin` enum('yes','no') NOT NULL DEFAULT 'no', `last_action` int(11) NOT NULL DEFAULT '0', `prev_last_action` int(11) NOT NULL DEFAULT '0', `last_login` int(11) NOT NULL DEFAULT '0', @@ -418,6 +419,7 @@ CREATE TABLE `prefix_users_entity` ( KEY `code` (`code`), KEY `last_action` (`last_action`), KEY `last_login` (`last_login`), + KEY `admin` (`admin`), FULLTEXT KEY `name` (`name`), FULLTEXT KEY `name_2` (`name`,`username`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/mod/htmlawed/start.php b/mod/htmlawed/start.php index 1fab03153..419034f5a 100644 --- a/mod/htmlawed/start.php +++ b/mod/htmlawed/start.php @@ -107,16 +107,23 @@ function htmlawed_filter_tags($hook, $entity_type, $returnvalue, $params) { $return = ""; $return = htmLawed($var, $htmlawed_config); } else { - $return = array(); + + array_walk_recursive($var, 'htmLawedArray', $htmlawed_config); - foreach($var as $key => $el) { - $return[$key] = htmLawed($el, $htmlawed_config); - } + $return = $var; } } return $return; } +/** + * wrapper function for htmlawed for handling arrays + */ +function htmLawedArray(&$v, $k, $htmlawed_config) { + $v = htmLawed($v, $htmlawed_config); +} + + register_elgg_event_handler('init', 'system', 'htmlawed_init'); diff --git a/mod/messages/views/default/messages/css.php b/mod/messages/views/default/messages/css.php index 6d318dcad..0ef15a791 100644 --- a/mod/messages/views/default/messages/css.php +++ b/mod/messages/views/default/messages/css.php @@ -64,6 +64,15 @@ a.privatemessages.new span { width:180px; overflow: hidden; } +.messages_to { + float: left; + margin-right: 10px; +} + +/* view and reply to message view */ +.message_body { + margin-left: 120px; +} .message_subject { float:left; width:513px; diff --git a/mod/notifications/views/default/notifications/subscriptions/forminternals.php b/mod/notifications/views/default/notifications/subscriptions/forminternals.php index 254f849bd..113d4b0fa 100644 --- a/mod/notifications/views/default/notifications/subscriptions/forminternals.php +++ b/mod/notifications/views/default/notifications/subscriptions/forminternals.php @@ -88,8 +88,7 @@ if (is_array($friends) && sizeof($friends)) { if (!isset($users[$letter])) { $users[$letter] = array(); } - $users[$letter][$user->name] = $user; - + $users[$letter][$user->guid] = $user; } } diff --git a/mod/profile/actions/edit.php b/mod/profile/actions/edit.php index 207559334..baeb49108 100644 --- a/mod/profile/actions/edit.php +++ b/mod/profile/actions/edit.php @@ -29,15 +29,21 @@ if (!is_array($accesslevel)) { $accesslevel = array(); } +/** + * wrapper for recursive array walk decoding + */ +function profile_array_decoder(&$v) { + $v = html_entity_decode($v, ENT_COMPAT, 'UTF-8'); +} + + foreach($CONFIG->profile as $shortname => $valuetype) { // the decoding is a stop gag to prevent && showing up in profile fields // because it is escaped on both input (get_input()) and output (view:output/text). see #561 and #1405. // must decode in utf8 or string corruption occurs. see #1567. $value = get_input($shortname); if (is_array($value)) { - foreach ($value as $k => $v) { - $value[$k] = html_entity_decode($v, ENT_COMPAT, 'UTF-8'); - } + array_walk_recursive($value, 'profile_array_decoder'); } else { $value = html_entity_decode($value, ENT_COMPAT, 'UTF-8'); } @@ -104,4 +110,4 @@ if (sizeof($input) > 0) { system_message(elgg_echo("profile:saved")); } -forward($profile_owner->getUrl());
\ No newline at end of file +forward($profile_owner->getUrl()); diff --git a/mod/search/languages/en.php b/mod/search/languages/en.php index 546a428a2..e3899500f 100644 --- a/mod/search/languages/en.php +++ b/mod/search/languages/en.php @@ -14,6 +14,7 @@ $english = array( 'search_types:comments' => 'Comments', 'search:comment_on' => 'Comment on "%s"', + 'search:comment_by' => 'by', 'search:unavailable_entity' => 'Unavailable Entity', ); diff --git a/mod/search/search_hooks.php b/mod/search/search_hooks.php index 0b606ac66..1af208d6e 100644 --- a/mod/search/search_hooks.php +++ b/mod/search/search_hooks.php @@ -257,7 +257,7 @@ function search_tags_hook($hook, $type, $value, $params) { $tags_str = implode('. ', $matched_tags_strs); $tags_str = search_get_highlighted_relevant_substrings($tags_str, $params['query']); - $tags_str = "($tags_str)"; + //$tags_str = "($tags_str)"; $entity->setVolatileData('search_matched_title', $title_str); $entity->setVolatileData('search_matched_description', $desc_str); diff --git a/mod/search/views/default/search/css.php b/mod/search/views/default/search/css.php index 4eb07d323..72b696059 100644 --- a/mod/search/views/default/search/css.php +++ b/mod/search/views/default/search/css.php @@ -76,3 +76,14 @@ .searchMatchColor5 { background-color: #4690d6; } + +/* formatting for the search results */ +.search_listing .item_extra { + border: 1px solid #cccccc; + margin: 2px; + padding: 3px; +} + +.search_listing .item_timestamp { + font-style: italic; +}
\ No newline at end of file diff --git a/mod/search/views/default/search/entity.php b/mod/search/views/default/search/entity.php index 2b08384d5..b65bad888 100644 --- a/mod/search/views/default/search/entity.php +++ b/mod/search/views/default/search/entity.php @@ -2,6 +2,14 @@ /** * Elgg search entity * + * Display largely controlled by a set of overrideable volatile data: + * - search_icon (defaults to entity icon) + * - search_matched_title + * - search_matched_description + * - search_matched_extra + * - search_url (defaults to entity->getURL()) + * - search_time (defaults to entity->time_updated or entity->time_created) + * * @package Elgg * @subpackage Core * @author Curverider Ltd @@ -10,46 +18,53 @@ $entity = $vars['entity']; -// display the entity's owner by default if available. -// @todo allow an option to switch to displaying the entity's icon instead. -$type = $entity->getType(); -if ($type == 'user' || $type == 'group') { - $icon = elgg_view('profile/icon', array('entity' => $entity, 'size' => 'tiny')); -} elseif ($owner = $entity->getOwnerEntity()) { - $icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'tiny')); -} else { - // display a generic icon if no owner, though there will probably be - // other problems if the owner can't be found. - $icon = elgg_view( - 'graphics/icon', array( - 'entity' => $entity, - 'size' => 'tiny', - )); +$icon = $entity->getVolatileData('search_icon'); +if (!$icon) { + // display the entity's owner by default if available. + // @todo allow an option to switch to displaying the entity's icon instead. + $type = $entity->getType(); + if ($type == 'user' || $type == 'group') { + $icon = elgg_view('profile/icon', array('entity' => $entity, 'size' => 'small')); + } elseif ($owner = $entity->getOwnerEntity()) { + $icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'small')); + } else { + // display a generic icon if no owner, though there will probably be + // other problems if the owner can't be found. + $icon = elgg_view( + 'graphics/icon', array( + 'entity' => $entity, + 'size' => 'small', + )); + } } $title = $entity->getVolatileData('search_matched_title'); $description = $entity->getVolatileData('search_matched_description'); $extra_info = $entity->getVolatileData('search_matched_extra'); -$url = $entity->getURL(); - -if (!$title) { - $title = elgg_echo('untitled'); +$url = $entity->getVolatileData('search_url'); +if (!$url) { + $url = $entity->getURL(); } - $title = "<a href=\"$url\">$title</a>"; -$tc = $entity->time_created; -$tu = $entity->time_updated; -$time = friendly_time(($tu > $tc) ? $tu : $tc); - -echo <<<___END +$time = $entity->getVolatileData('search_time'); +if (!$time) { + $tc = $entity->time_created; + $tu = $entity->time_updated; + $time = friendly_time(($tu > $tc) ? $tu : $tc); +} +?> <div class="search_listing clearfloat"> - <div class="search_listing_icon">$icon</div> + <div class="search_listing_icon"><?php echo $icon; ?></div> <div class="search_listing_info"> - <p class="entity_title">$title</p>$description - <p class="entity_subtext">$time $extra_info</p> + <p class="item_title"><?php echo $title; ?></p> + <p class="item_description"><?php echo $description; ?></p> +<?php +if ($extra_info) { +?> + <p class="item_extra"><?php echo $extra_info; ?></p> +<?php +} +?> + <p class="item_timestamp"><?php echo $time; ?></p> </div> </div> -___END; - -// php bug. must have close tag after heredocs -?>
\ No newline at end of file diff --git a/mod/search/views/rss/search/comments/entity.php b/mod/search/views/rss/search/comments/entity.php new file mode 100644 index 000000000..1b788fbae --- /dev/null +++ b/mod/search/views/rss/search/comments/entity.php @@ -0,0 +1,53 @@ +<?php +/** + * Elgg search comment view + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ +$entity = $vars['entity']; + +$author_name = ''; +$comment_author_guid = $entity->getVolatileData('search_matched_comment_owner_guid'); +$author = get_user($comment_author_guid); +if ($author) { + $author_name = $author->name; +} + +// @todo Sometimes we find comments on entities we can't display... +if ($entity->getVolatileData('search_unavailable_entity')) { + $title = sprintf(elgg_echo('search:comment_on'), elgg_echo('search:unavailable_entity')); +} else { + if ($entity->getType() == 'object') { + $title = $entity->title; + } else { + $title = $entity->name; + } + + if (!$title) { + $title = elgg_echo('item:' . $entity->getType() . ':' . $entity->getSubtype()); + } + + if (!$title) { + $title = elgg_echo('item:' . $entity->getType()); + } + + $title = sprintf(elgg_echo('search:comment_on'), $title); + $title .= ' ' . elgg_echo('search:comment_by') . ' ' . $author_name; + $url = $entity->getURL() . '#annotation-' . $entity->getVolatileData('search_match_annotation_id'); +} + +$description = $entity->getVolatileData('search_matched_comment'); +$tc = $entity->getVolatileData('search_matched_comment_time_created');; + +?> + +<item> + <guid isPermaLink='true'><?php echo htmlspecialchars($url); ?></guid> + <pubDate><?php echo date("r", $tc) ?></pubDate> + <link><?php echo htmlspecialchars($url); ?></link> + <title><![CDATA[<?php echo $title; ?>]]></title> + <description><![CDATA[<?php echo $description; ?>]]></description> +</item> diff --git a/views/default/account/forms/register.php b/views/default/account/forms/register.php index b46e9df0b..580922eb7 100644 --- a/views/default/account/forms/register.php +++ b/views/default/account/forms/register.php @@ -13,7 +13,9 @@ $email = get_input('e'); $name = get_input('n'); $admin_option = false; -if (($_SESSION['user']->isAdmin()) && ($vars['show_admin'])) { +$loggedin_user = get_loggedin_user(); + +if ($loggedin_user && $loggedin_user->isAdmin() && isset($vars['show_admin'])) { $admin_option = true; } @@ -47,4 +49,4 @@ $form_body .= elgg_view('input/submit', array('internalname' => 'submit', 'value </div> <script type="text/javascript"> $(document).ready(function() { $('input[name=name]').focus(); }); -</script>
\ No newline at end of file +</script> diff --git a/views/default/friends/picker.php b/views/default/friends/picker.php index bca3e5e89..4b8d10111 100644 --- a/views/default/friends/picker.php +++ b/views/default/friends/picker.php @@ -79,7 +79,7 @@ if (is_array($vars['entities']) && sizeof($vars['entities'])) { if (!isset($users[$letter])) { $users[$letter] = array(); } - $users[$letter][$user->name] = $user; + $users[$letter][$user->guid] = $user; } } diff --git a/views/default/output/friendlytitle.php b/views/default/output/friendlytitle.php index a92726f69..fbc4f39de 100644 --- a/views/default/output/friendlytitle.php +++ b/views/default/output/friendlytitle.php @@ -8,11 +8,12 @@ $title = $vars['title']; - -$title = trim($title); -$title = strtolower($title); + +//$title = iconv('UTF-8', 'ASCII//TRANSLIT', $title); $title = preg_replace("/[^\w ]/","",$title); $title = str_replace(" ","-",$title); $title = str_replace("--","-",$title); +$title = trim($title); +$title = strtolower($title); echo $title; |