]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Merged 5605:5622 from 1.7 to trunk.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 5 Apr 2010 16:51:32 +0000 (16:51 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 5 Apr 2010 16:51:32 +0000 (16:51 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@5623 36083f99-b078-4883-b0ff-0f9b5a30f544

15 files changed:
engine/lib/entities.php
engine/lib/input.php
engine/schema/mysql.sql
mod/htmlawed/start.php
mod/messages/views/default/messages/css.php
mod/notifications/views/default/notifications/subscriptions/forminternals.php
mod/profile/actions/edit.php
mod/search/languages/en.php
mod/search/search_hooks.php
mod/search/views/default/search/css.php
mod/search/views/default/search/entity.php
mod/search/views/rss/search/comments/entity.php [new file with mode: 0644]
views/default/account/forms/register.php
views/default/friends/picker.php
views/default/output/friendlytitle.php

index 987328adc11777cf37eecb296058e79700c0b413..88cf3e3a7079994c9ad85011c17f75c5ac81915a 100644 (file)
@@ -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;
index e21c909fc0d7e6f4214643996d9ee9df1ab34bfe..26416d646188e5029239311a7437bf0ada8d255d 100644 (file)
@@ -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);
index 56c2a4077e0b128076a1a8e1ab7f01573f10588b..23e81f39de1a28d694471cdb2485d8a52a1a6f69 100644 (file)
@@ -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;
index 1fab03153d7079c610c06ba198a06bc337fdd044..419034f5a5bd7bc1fe28795ae5b38aa00e27787d 100644 (file)
@@ -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');
index 6d318dcad1db265af1e2d9c2692bd27b176100b2..0ef15a791d41877bc9c5c12e84faf2d4afcdde12 100644 (file)
@@ -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;
index 254f849bd564b42e50bda58d254597f8f2f68982..113d4b0fa9f9dd6f0f7f39ac6b8ae9ebd95b01c5 100644 (file)
@@ -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;
        }
 }
 
index 207559334b1d11dcbb818e3c396d2b1b06e997fb..baeb49108fbc41306c86ef56dd6ad35168731a83 100644 (file)
@@ -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 &amp;&amp; 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());
index 546a428a2d01aa89b1708c8142e73fa73dc86a96..e3899500fddea098ccf4f753882a335e011b1907 100644 (file)
@@ -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',
 );
 
index 0b606ac666414dd520e625f0feef72903f9f2e8e..1af208d6e68d7cc673f13c3d2d38798e6321e905 100644 (file)
@@ -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);
index 4eb07d323ee0fd7e7eb182f7a78ae4ace592e9a7..72b6960591513b7bee68b03708b5a7030e4eb54f 100644 (file)
 .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
index 2b08384d5ddb342f53cc413a6b0ba80d176f059c..b65bad8881cddabbfe6b72dc37e30b4fc4ca0740 100644 (file)
@@ -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
 
 $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 (file)
index 0000000..1b788fb
--- /dev/null
@@ -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>
index b46e9df0bd92d0fb622f76d71a9d5baf71391881..580922eb7807f7ca3bb5d26fd88bdc8f7815f008 100644 (file)
@@ -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>
index bca3e5e89ca0de94b7a8f68e163c8154a30c0c7f..4b8d101118ea1381e9514a789bb4b9347e5b4654 100644 (file)
@@ -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;
        }
 }
 
index a92726f6948942135b426355b89a9dc4845091a1..fbc4f39de221cb517acf19747ec2b27aa2077c14 100644 (file)
@@ -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;