aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-05 16:08:42 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-05 16:08:42 +0000
commit36ef345eb6425106f061fb866d9fa66d051e16df (patch)
tree53fb2bd05f8b5e2010f9e3d1e93075ad7071ec1e /mod
parent5571ca5b350fd1735f13af7ddfbb88afa6befb0c (diff)
downloadelgg-36ef345eb6425106f061fb866d9fa66d051e16df.tar.gz
elgg-36ef345eb6425106f061fb866d9fa66d051e16df.tar.bz2
Merged 5530:5604 from 1.7 to trunk.
git-svn-id: http://code.elgg.org/elgg/trunk@5622 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod')
-rw-r--r--mod/bookmarks/index.php3
-rw-r--r--mod/bookmarks/start.php2
-rw-r--r--mod/bookmarks/views/default/widgets/bookmarks/edit.php21
-rw-r--r--mod/file/index.php5
-rw-r--r--mod/file/start.php5
-rw-r--r--mod/file/views/default/widgets/filerepo/edit.php35
-rw-r--r--mod/file/views/default/widgets/filerepo/view.php5
-rw-r--r--mod/groups/discussions.php5
-rw-r--r--mod/pages/index.php3
-rw-r--r--mod/pages/views/default/widgets/pages/edit.php24
-rw-r--r--mod/pages/views/default/widgets/pages/view.php12
-rw-r--r--mod/profile/actions/edit.php11
-rw-r--r--mod/profile/icondirect.php147
-rw-r--r--mod/profile/views/default/profile/menu/adminlinks.php4
-rw-r--r--mod/search/index.php7
-rw-r--r--mod/thewire/actions/add.php102
-rw-r--r--mod/thewire/everyone.php4
-rw-r--r--mod/thewire/languages/en.php5
-rw-r--r--mod/thewire/start.php6
-rw-r--r--mod/thewire/views/default/thewire/activity_view.php48
-rw-r--r--mod/thewire/views/default/thewire/css.php1
-rw-r--r--mod/thewire/views/default/widgets/thewire/edit.php30
-rw-r--r--mod/thewire/views/default/widgets/thewire/view.php40
-rw-r--r--mod/thewire/views/rss/search/object/thewire/entity.php28
24 files changed, 230 insertions, 323 deletions
diff --git a/mod/bookmarks/index.php b/mod/bookmarks/index.php
index 0b8508cc9..187ee3fcf 100644
--- a/mod/bookmarks/index.php
+++ b/mod/bookmarks/index.php
@@ -14,6 +14,9 @@ global $CONFIG;
// Start engine
require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+// access check for closed groups
+group_gatekeeper();
+
$page_owner = page_owner_entity();
if ($page_owner === false || is_null($page_owner)) {
$page_owner = $_SESSION['user'];
diff --git a/mod/bookmarks/start.php b/mod/bookmarks/start.php
index 9588f7a8a..c37899034 100644
--- a/mod/bookmarks/start.php
+++ b/mod/bookmarks/start.php
@@ -35,7 +35,7 @@ function bookmarks_init() {
register_entity_url_handler('bookmark_url','object','bookmarks');
// Shares widget
- add_widget_type('bookmarks',elgg_echo("bookmarks:recent"),elgg_echo("bookmarks:widget:description"));
+ add_widget_type('bookmarks',elgg_echo("bookmarks"),elgg_echo("bookmarks:widget:description"));
// Register entity type
register_entity_type('object','bookmarks');
diff --git a/mod/bookmarks/views/default/widgets/bookmarks/edit.php b/mod/bookmarks/views/default/widgets/bookmarks/edit.php
index 2ae8af6e4..2098b200b 100644
--- a/mod/bookmarks/views/default/widgets/bookmarks/edit.php
+++ b/mod/bookmarks/views/default/widgets/bookmarks/edit.php
@@ -13,15 +13,16 @@
<p>
<?php echo elgg_echo('bookmarks:numbertodisplay'); ?>:
<select name="params[num_display]">
- <option value="1" <?php if($vars['entity']->num_display == 1) echo "SELECTED"; ?>>1</option>
- <option value="2" <?php if($vars['entity']->num_display == 2) echo "SELECTED"; ?>>2</option>
- <option value="3" <?php if($vars['entity']->num_display == 3) echo "SELECTED"; ?>>3</option>
- <option value="4" <?php if($vars['entity']->num_display == 4) echo "SELECTED"; ?>>4</option>
- <option value="5" <?php if($vars['entity']->num_display == 5) echo "SELECTED"; ?>>5</option>
- <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option>
- <option value="7" <?php if($vars['entity']->num_display == 7) echo "SELECTED"; ?>>7</option>
- <option value="8" <?php if($vars['entity']->num_display == 8) echo "SELECTED"; ?>>8</option>
- <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option>
- <option value="10" <?php if($vars['entity']->num_display == 10) echo "SELECTED"; ?>>10</option>
+<?php
+
+for ($i=1; $i<=10; $i++) {
+ $selected = '';
+ if ($vars['entity']->num_display == $i) {
+ $selected = "selected='selected'";
+ }
+
+ echo " <option value='{$i}' $selected >{$i}</option>\n";
+}
+?>
</select>
</p> \ No newline at end of file
diff --git a/mod/file/index.php b/mod/file/index.php
index 6a418ac6a..848de9e53 100644
--- a/mod/file/index.php
+++ b/mod/file/index.php
@@ -13,9 +13,8 @@
require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- if (is_callable('group_gatekeeper')) {
- group_gatekeeper();
- }
+ // access check for closed groups
+ group_gatekeeper();
//set the title
if (page_owner() == get_loggedin_userid()) {
diff --git a/mod/file/start.php b/mod/file/start.php
index 1345dec44..b8a26fab5 100644
--- a/mod/file/start.php
+++ b/mod/file/start.php
@@ -43,7 +43,7 @@
register_page_handler('file','file_page_handler');
// Add a new file widget
- add_widget_type('filerepo',elgg_echo("file:widget"),elgg_echo("file:widget:description"));
+ add_widget_type('filerepo',elgg_echo("file"),elgg_echo("file:widget:description"));
// Register a URL handler for files
register_entity_url_handler('file_url','object','file');
@@ -235,5 +235,8 @@
register_action("file/upload", false, $CONFIG->pluginspath . "file/actions/upload.php");
register_action("file/save", false, $CONFIG->pluginspath . "file/actions/save.php");
register_action("file/delete", false, $CONFIG->pluginspath. "file/actions/delete.php");
+
+ // temporary - see #2010
+ register_action("file/download", false, $CONFIG->pluginspath. "file/actions/download.php");
?>
diff --git a/mod/file/views/default/widgets/filerepo/edit.php b/mod/file/views/default/widgets/filerepo/edit.php
index 35d633058..0d1901662 100644
--- a/mod/file/views/default/widgets/filerepo/edit.php
+++ b/mod/file/views/default/widgets/filerepo/edit.php
@@ -1,19 +1,24 @@
+<?php
+// set default value
+if (!isset($vars['entity']->num_display)) {
+ $vars['entity']->num_display = 4;
+}
+?>
<p>
- <?php echo elgg_echo("file:num_files"); ?>:
- <select name="params[num_display]">
- <option value="1" <?php if($vars['entity']->num_display == 1) echo "SELECTED"; ?>>1</option>
- <option value="2" <?php if($vars['entity']->num_display == 2) echo "SELECTED"; ?>>2</option>
- <option value="3" <?php if($vars['entity']->num_display == 3) echo "SELECTED"; ?>>3</option>
- <option value="4" <?php if($vars['entity']->num_display == 4) echo "SELECTED"; ?>>4</option>
- <option value="5" <?php if($vars['entity']->num_display == 5) echo "SELECTED"; ?>>5</option>
- <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option>
- <option value="7" <?php if($vars['entity']->num_display == 7) echo "SELECTED"; ?>>7</option>
- <option value="8" <?php if($vars['entity']->num_display == 8) echo "SELECTED"; ?>>8</option>
- <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option>
- <option value="10" <?php if($vars['entity']->num_display == 10) echo "SELECTED"; ?>>10</option>
- <option value="15" <?php if($vars['entity']->num_display == 15) echo "SELECTED"; ?>>15</option>
- <option value="20" <?php if($vars['entity']->num_display == 20) echo "SELECTED"; ?>>20</option>
- </select>
+ <?php echo elgg_echo("file:num_files"); ?>:
+ <select name="params[num_display]">
+<?php
+$options = array(1,2,3,4,5,6,7,8,9,10,15,20);
+foreach ($options as $option) {
+ $selected = '';
+ if ($vars['entity']->num_display == $option) {
+ $selected = "selected='selected'";
+ }
+
+ echo " <option value='{$option}' $selected >{$option}</option>\n";
+}
+?>
+ </select>
</p>
<p>
diff --git a/mod/file/views/default/widgets/filerepo/view.php b/mod/file/views/default/widgets/filerepo/view.php
index 01fdefa48..276ece053 100644
--- a/mod/file/views/default/widgets/filerepo/view.php
+++ b/mod/file/views/default/widgets/filerepo/view.php
@@ -17,8 +17,9 @@ $('a.show_file_desc').click(function () {
//the number of files to display
$number = (int) $vars['entity']->num_display;
- if (!$number)
- $number = 1;
+ if (!$number) {
+ $number = 4;
+ }
//get the layout view which is set by the user in the edit panel
$get_view = (int) $vars['entity']->gallery_list;
diff --git a/mod/groups/discussions.php b/mod/groups/discussions.php
index d4478039e..c3166dc95 100644
--- a/mod/groups/discussions.php
+++ b/mod/groups/discussions.php
@@ -14,8 +14,9 @@
// Load Elgg engine
require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
- group_gatekeeper();
+
+ // access check for closed groups
+ group_gatekeeper();
// Display them
$area1 = elgg_view_title(elgg_echo("groups:latestdiscussion"));
diff --git a/mod/pages/index.php b/mod/pages/index.php
index 5b31c6347..ad8aaaad2 100644
--- a/mod/pages/index.php
+++ b/mod/pages/index.php
@@ -24,7 +24,8 @@
if ($owner instanceof ElggUser) add_submenu_item(elgg_echo('pages:welcome'), $CONFIG->url . "pg/pages/welcome/", 'pagesactions');
}
- if (is_callable('group_gatekeeper')) group_gatekeeper();
+ // access check for closed groups
+ group_gatekeeper();
$limit = get_input("limit", 10);
$offset = get_input("offset", 0);
diff --git a/mod/pages/views/default/widgets/pages/edit.php b/mod/pages/views/default/widgets/pages/edit.php
index 8fb2511f7..9504d5fdb 100644
--- a/mod/pages/views/default/widgets/pages/edit.php
+++ b/mod/pages/views/default/widgets/pages/edit.php
@@ -10,8 +10,24 @@
* @link http://elgg.com/
*/
+if (!isset($vars['entity']->pages_num)) {
+ $vars['entity']->pages_num = 4;
+}
+
+?>
+<p>
+ <?php echo elgg_echo("pages:num"); ?>:
+ <select name="params[pages_num]">
+<?php
+
+for ($i=1; $i<=10; $i++) {
+ $selected = '';
+ if ($vars['entity']->pages_num == $i) {
+ $selected = "selected='selected'";
+ }
+
+ echo " <option value='{$i}' $selected >{$i}</option>\n";
+}
?>
- <p>
- <?php echo elgg_echo("pages:num"); ?>
- <input type="text" name="params[pages_num]" value="<?php echo htmlentities($vars['entity']->pages_num); ?>" />
- </p> \ No newline at end of file
+ </select>
+</p> \ No newline at end of file
diff --git a/mod/pages/views/default/widgets/pages/view.php b/mod/pages/views/default/widgets/pages/view.php
index 2ca32b284..425e4f501 100644
--- a/mod/pages/views/default/widgets/pages/view.php
+++ b/mod/pages/views/default/widgets/pages/view.php
@@ -16,11 +16,17 @@
*/
$num_display = (int) $vars['entity']->pages_num;
+ if (!$num_display) {
+ $num_display = 4;
+ }
$pages = elgg_list_entities(array('types' => 'object', 'subtypes' => 'page_top', 'container_guid' => page_owner(), 'limit' => $num_display, 'full_view' => FALSE));
- $pagesurl = $vars['url'] . "pg/pages/owned/" . page_owner_entity()->username;
- $pages .= "<div class=\"pages_widget_singleitem_more\"><a href=\"{$pagesurl}\">" . elgg_echo('pages:more') . "</a></div>";
-
+
+ if ($pages) {
+ $pagesurl = $vars['url'] . "pg/pages/owned/" . page_owner_entity()->username;
+ $pages .= "<div class=\"pages_widget_singleitem_more\"><a href=\"{$pagesurl}\">" . elgg_echo('pages:more') . "</a></div>";
+ }
+
echo "<div id=\"pages_widget\">" . $pages . "</div>";
?> \ No newline at end of file
diff --git a/mod/profile/actions/edit.php b/mod/profile/actions/edit.php
index 4afe4cd47..207559334 100644
--- a/mod/profile/actions/edit.php
+++ b/mod/profile/actions/edit.php
@@ -33,10 +33,17 @@ 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 = html_entity_decode(get_input($shortname), ENT_COMPAT, 'UTF-8');
+ $value = get_input($shortname);
+ if (is_array($value)) {
+ foreach ($value as $k => $v) {
+ $value[$k] = html_entity_decode($v, ENT_COMPAT, 'UTF-8');
+ }
+ } else {
+ $value = html_entity_decode($value, ENT_COMPAT, 'UTF-8');
+ }
// limit to reasonable sizes.
- if ($valuetype != 'longtext' && elgg_strlen($value) > 250) {
+ if (!is_array($value) && $valuetype != 'longtext' && elgg_strlen($value) > 250) {
$error = sprintf(elgg_echo('profile:field_too_long'), elgg_echo("profile:{$shortname}"));
register_error($error);
forward($_SERVER['HTTP_REFERER']);
diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php
index a9aed2eea..353ce389c 100644
--- a/mod/profile/icondirect.php
+++ b/mod/profile/icondirect.php
@@ -1,125 +1,28 @@
<?php
-/**
- * Elgg profile icon
- *
- * @package ElggProfile
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd <info@elgg.com>
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.com/
-*/
-require_once(dirname(dirname(dirname(__FILE__))). '/engine/settings.php');
+ /**
+ * Elgg profile icon cache/bypass
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
-/**
- * UTF safe str_split.
- * This is only used here since we don't have access to the file store code.
- * TODO: This is a horrible hack, so clean this up!
- */
-function __id_mb_str_split($string, $charset = 'UTF8'){
- if (is_callable('mb_substr')){
- $length = mb_strlen($string);
- $array = array();
-
- while ($length){
- $array[] = mb_substr($string, 0, 1, $charset);
- $string = mb_substr($string, 1, $length, $charset);
- $length = mb_strlen($string);
- }
-
- return $array;
- } else {
- return str_split($string);
- }
-
- return FALSE;
-}
-
-global $CONFIG;
-$contents = '';
-
-if ($mysql_dblink = @mysql_connect($CONFIG->dbhost,$CONFIG->dbuser,$CONFIG->dbpass, true)) {
- $username = $_GET['username'];
- //$username = preg_replace('/[^A-Za-z0-9\_\-]/i','',$username);
- $blacklist = '/[' .
- '\x{0080}-\x{009f}' . # iso-8859-1 control chars
- '\x{00a0}' . # non-breaking space
- '\x{2000}-\x{200f}' . # various whitespace
- '\x{2028}-\x{202f}' . # breaks and control chars
- '\x{3000}' . # ideographic space
- '\x{e000}-\x{f8ff}' . # private use
- ']/u';
- if (
- preg_match($blacklist, $username) ||
- (strpos($username, '/')!==false) ||
- (strpos($username, '\\')!==false) ||
- (strpos($username, '"')!==false) ||
- (strpos($username, '\'')!==false) ||
- (strpos($username, '*')!==false) ||
- (strpos($username, '&')!==false) ||
- (strpos($username, ' ')!==false)
- ) exit;
-
- $userarray = __id_mb_str_split($username);
-
- $matrix = '';
- $length = 5;
- if (sizeof($userarray) < $length) $length = sizeof($userarray);
- for ($n = 0; $n < $length; $n++) {
- $matrix .= $userarray[$n] . "/";
- }
-
- // Get the size
- $size = strtolower($_GET['size']);
- if (!in_array($size,array('large','medium','small','tiny','master','topbar')))
- $size = "medium";
-
- // Try and get the icon
- if (@mysql_select_db($CONFIG->dbname,$mysql_dblink)) {
- // get dataroot and simplecache_enabled in one select for efficiency
- if ($result = mysql_query("select name, value from {$CONFIG->dbprefix}datalists where name in ('dataroot','simplecache_enabled')",$mysql_dblink)) {
- $simplecache_enabled = true;
- $row = mysql_fetch_object($result);
- while ($row) {
- if ($row->name == 'dataroot') {
- $dataroot = $row->value;
- } else if ($row->name == 'simplecache_enabled') {
- $simplecache_enabled = $row->value;
- }
- $row = mysql_fetch_object($result);
- }
- }
- }
-}
- //@todo forcing through the framework to ensure the matrix
- // is created the same way.
- //if ($simplecache_enabled) {
- if (false) {
- $filename = $dataroot . $matrix . "{$username}/profile/" . $username . $size . ".jpg";
- $contents = @file_get_contents($filename);
- if (empty($contents)) {
- global $viewinput;
- $viewinput['view'] = 'icon/user/default/'.$size;
- ob_start();
- include(dirname(dirname(dirname(__FILE__))).'/simplecache/view.php');
- $loc = ob_get_clean();
- header('Location: ' . $loc);
- exit;
- //$contents = @file_get_contents(dirname(__FILE__) . "/graphics/default{$size}.jpg");
- } else {
- header("Content-type: image/jpeg");
- header('Expires: ' . date('r',time() + 864000));
- header("Pragma: public");
- header("Cache-Control: public");
- header("Content-Length: " . strlen($contents));
- $splitString = str_split($contents, 1024);
- foreach($splitString as $chunk)
- echo $chunk;
- }
- } else {
- mysql_close($mysql_dblink);
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- set_input('username',$username);
- set_input('size',$size);
- require_once(dirname(__FILE__).'/icon.php');
- } \ No newline at end of file
+ // This should provide faster access to profile icons by not loading the
+ // engine but directly grabbing the file from the user's profile directory.
+ // The speedup was broken in Elgg 1.7 because of a change in directory structure.
+ // The link to this script is provided in profile_usericon_hook(). To work
+ // in 1.7 forward, the link has to be updated to provide more information.
+ // The profile icon filename should also be changed to not use username.
+
+ // To see previous code, see svn history.
+
+ // At the moment, this does not serve much of a purpose other than provide
+ // continuity. It currently just includes icon.php which uses the engine.
+
+ // see #1989 and #2035
+
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ require_once(dirname(__FILE__).'/icon.php');
diff --git a/mod/profile/views/default/profile/menu/adminlinks.php b/mod/profile/views/default/profile/menu/adminlinks.php
index a88f96816..d2a36397d 100644
--- a/mod/profile/views/default/profile/menu/adminlinks.php
+++ b/mod/profile/views/default/profile/menu/adminlinks.php
@@ -23,10 +23,10 @@ if (isadminloggedin()){
}
echo elgg_view('output/confirmlink', array('text' => elgg_echo("delete"), 'href' => "{$vars['url']}action/admin/user/delete?guid={$vars['entity']->guid}"));
echo elgg_view('output/confirmlink', array('text' => elgg_echo("resetpassword"), 'href' => "{$vars['url']}action/admin/user/resetpassword?guid={$vars['entity']->guid}"));
- if (!$vars['entity']->admin) {
+ if (!$vars['entity']->isAdmin()) {
echo elgg_view('output/confirmlink', array('text' => elgg_echo("makeadmin"), 'href' => "{$vars['url']}action/admin/user/makeadmin?guid={$vars['entity']->guid}"));
} else {
echo elgg_view('output/confirmlink', array('text' => elgg_echo("removeadmin"), 'href' => "{$vars['url']}action/admin/user/removeadmin?guid={$vars['entity']->guid}"));
}
}
- } \ No newline at end of file
+ }
diff --git a/mod/search/index.php b/mod/search/index.php
index a09c688ed..8ee44d9e7 100644
--- a/mod/search/index.php
+++ b/mod/search/index.php
@@ -8,11 +8,16 @@
* @link http://elgg.org/
*/
+// Search supports RSS
+global $autofeed;
+$autofeed = true;
+
// $search_type == all || entities || trigger plugin hook
$search_type = get_input('search_type', 'all');
// @todo there is a bug in get_input that makes variables have slashes sometimes.
-$query = stripslashes(get_input('q', get_input('tag', '', FALSE), FALSE));
+// XSS protection is more important that searching for HTML.
+$query = stripslashes(get_input('q', get_input('tag', '')));
// get limit and offset. override if on search dashboard, where only 2
// of each most recent entity types will be shown.
diff --git a/mod/thewire/actions/add.php b/mod/thewire/actions/add.php
index 1a59a979f..de2538e1e 100644
--- a/mod/thewire/actions/add.php
+++ b/mod/thewire/actions/add.php
@@ -1,63 +1,45 @@
<?php
- /**
- * Elgg thewire: add shout action
- *
- * @package Elggthewire
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider <info@elgg.com>
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.org/
- */
-
- // Make sure we're logged in (send us to the front page if not)
- if (!isloggedin()) forward();
-
- // Get input data
- $body = get_input('new_post_textarea');
- $tags = get_input('thewiretags');
- $access_id = (int)get_default_access();
- if ($access_id == ACCESS_PRIVATE)
- $access_id = ACCESS_LOGGED_IN; // Private wire messages are pointless
- $location = get_input('location');
- $method = get_input('method');
- $parent = (int)get_input('parent', 0);
- if(!$parent)
- $parent = 0;
-
- // convert the shout body into tags
- $tagarray = filter_string($body);
-
- // Make sure the title / description aren't blank
- if (empty($body)) {
- register_error(elgg_echo("thewire:blank"));
- forward("mod/thewire/add.php");
-
- // Otherwise, save the thewire post
- } else {
-
- if (!thewire_save_post($body, $access_id, $parent, $method)) {
- register_error(elgg_echo("thewire:error"));
- if($location == "activity")
- forward("mod/riverdashboard/");
- else
- forward("mod/thewire/add.php");
- }
-
- // Now let's add tags. We can pass an array directly to the object property! Easy.
- if (is_array($tagarray)) {
- $thewire->tags = $tagarray;
- }
-
- // Success message
- system_message(elgg_echo("thewire:posted"));
-
- // Forward
- if($location == "activity")
- forward("mod/riverdashboard/");
- else
- forward("mod/thewire/everyone.php");
-
- }
-
+/**
+ * Elgg thewire: add shout action
+ *
+ * @package Elggthewire
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.org/
+ */
+
+// Make sure we're logged in (send us to the front page if not)
+if (!isloggedin()) forward();
+
+// Get input data
+$body = get_input('note');
+$access_id = (int)get_default_access();
+if ($access_id == ACCESS_PRIVATE) {
+ $access_id = ACCESS_LOGGED_IN; // Private wire messages are pointless
+}
+$method = get_input('method');
+$parent = (int)get_input('parent', 0);
+if (!$parent) {
+ $parent = 0;
+}
+// Make sure the body isn't blank
+if (empty($body)) {
+ register_error(elgg_echo("thewire:blank"));
+ forward("mod/thewire/add.php");
+}
+
+if (!thewire_save_post($body, $access_id, $parent, $method)) {
+ register_error(elgg_echo("thewire:error"));
+ forward("mod/thewire/add.php");
+}
+
+
+// Success message
+system_message(elgg_echo("thewire:posted"));
+
+// Forward
+forward("mod/thewire/everyone.php");
+
?> \ No newline at end of file
diff --git a/mod/thewire/everyone.php b/mod/thewire/everyone.php
index 030a9ece3..f2f557ee9 100644
--- a/mod/thewire/everyone.php
+++ b/mod/thewire/everyone.php
@@ -16,7 +16,9 @@
$area2 = elgg_view_title(elgg_echo("thewire:everyone"));
//add form
- $area2 .= elgg_view("thewire/forms/add");
+ if (isloggedin()) {
+ $area2 .= elgg_view("thewire/forms/add");
+ }
$offset = (int)get_input('offset', 0);
$area2 .= elgg_list_entities(array('types' => 'object', 'subtypes' => 'thewire', 'offset' => $offset));
diff --git a/mod/thewire/languages/en.php b/mod/thewire/languages/en.php
index 3540cef78..0fb114028 100644
--- a/mod/thewire/languages/en.php
+++ b/mod/thewire/languages/en.php
@@ -27,6 +27,7 @@
'thewire:doing' => "What are you doing? Tell everyone on the wire:",
'thewire:newpost' => 'New wire post',
'thewire:addpost' => 'Post to the wire',
+ 'thewire:by' => "Wire post by %s",
/**
@@ -44,11 +45,11 @@
**/
'thewire:sitedesc' => 'This widget shows the latest site notes posted to the wire',
- 'thewire:yourdesc' => 'This widget shows your latest notes posted to the wire',
+ 'thewire:yourdesc' => 'This widget displays your latest wire posts',
'thewire:friendsdesc' => 'This widget will show the latest from your friends on the wire',
'thewire:friends' => 'Your friends on the wire',
'thewire:num' => 'Number of items to display',
-
+ 'thewire:moreposts' => 'More wire posts',
/**
diff --git a/mod/thewire/start.php b/mod/thewire/start.php
index ef6564678..9e078fa58 100644
--- a/mod/thewire/start.php
+++ b/mod/thewire/start.php
@@ -94,7 +94,7 @@
}
// If the URL is just 'thewire/username', or just 'thewire/', load the standard thewire index
} else {
- @include(dirname(__FILE__) . "/index.php");
+ require(dirname(__FILE__) . "/index.php");
return true;
}
@@ -165,10 +165,6 @@
// Set its description appropriately
$thewire->description = elgg_substr(strip_tags($post), 0, 160);
- /*if (is_callable('mb_substr'))
- $thewire->description = mb_substr(strip_tags($post), 0, 160);
- else
- $thewire->description = substr(strip_tags($post), 0, 160);*/
// add some metadata
$thewire->method = $method; //method, e.g. via site, sms etc
diff --git a/mod/thewire/views/default/thewire/activity_view.php b/mod/thewire/views/default/thewire/activity_view.php
deleted file mode 100644
index 7edd64680..000000000
--- a/mod/thewire/views/default/thewire/activity_view.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-
- /**
- * New wire post view for the activity stream
- */
-
- //grab the users latest from the wire
- $latest_wire = elgg_list_entities(array('types' => 'object', 'subtypes' => 'thewire', 'owner_guid' => $_SESSION['user']->getGUID(), 'limit' => 1, 'full_view' => TRUE, 'view_type_toggle' => FALSE, 'pagination' => FALSE));
-
-?>
-
-<script>
-function textCounter(field,cntfield,maxlimit) {
- // if too long...trim it!
- if (field.value.length > maxlimit) {
- field.value = field.value.substring(0, maxlimit);
- } else {
- // otherwise, update 'characters left' counter
- cntfield.value = maxlimit - field.value.length;
- }
-}
-</script>
-
-<div class="sidebarBox">
-
- <form action="<?php echo $vars['url']; ?>action/thewire/add" method="post" name="noteForm">
-
- <?php
- $display .= "<h3>" . elgg_echo('thewire:newpost') . "</h3><textarea name='note' value='' onKeyDown=\"textCounter(document.noteForm.note,document.noteForm.remLen1,140)\" onKeyUp=\"textCounter(document.noteForm.note,document.noteForm.remLen1,140)\" id=\"thewire_sidebarInputBox\">{$msg}</textarea><br />";
- $display .= "<div class='thewire_characters_remaining'><input readonly type=\"text\" name=\"remLen1\" size=\"3\" maxlength=\"3\" value=\"140\" class=\"thewire_characters_remaining_field\">";
- echo $display;
- echo elgg_echo("thewire:charleft") . "</div>";
- ?>
- <input type="hidden" name="method" value="site" />
- <input type="hidden" name="location" value="activity" />
- <input type="hidden" name="access_id" value="2" />
- <input type="submit" value="<?php echo elgg_echo('save'); ?>" id="thewire_submit_button" />
- </form>
-
- <div class="last_wirepost">
- <?php
- echo $latest_wire;
- ?>
- </div>
-
- <img src="<?php echo $vars['url']; ?>mod/thewire/graphics/river_icon_thewire.gif" alt="the wire" align="left" style="margin-right:5px;"/><a href="<?php echo $vars['url']; ?>mod/thewire/everyone.php" />Read the wire</a>
-
-</div> \ No newline at end of file
diff --git a/mod/thewire/views/default/thewire/css.php b/mod/thewire/views/default/thewire/css.php
index 8b46f4b18..30959e5d3 100644
--- a/mod/thewire/views/default/thewire/css.php
+++ b/mod/thewire/views/default/thewire/css.php
@@ -75,6 +75,7 @@
margin-top:-3px;
float:left;
width:620px;
+ overflow: hidden;
}
.wire_post_options {
float:right;
diff --git a/mod/thewire/views/default/widgets/thewire/edit.php b/mod/thewire/views/default/widgets/thewire/edit.php
index 32a5c8bf7..969015ab8 100644
--- a/mod/thewire/views/default/widgets/thewire/edit.php
+++ b/mod/thewire/views/default/widgets/thewire/edit.php
@@ -1,14 +1,22 @@
<?php
+// set default value
+if (!isset($vars['entity']->num_display)) {
+ $vars['entity']->num_display = 4;
+}
+?>
+<p>
+ <?php echo elgg_echo("thewire:num"); ?>
+ <select name="params[num_display]">
+<?php
+$options = array(1,2,3,4,5,6);
+foreach ($options as $option) {
+ $selected = '';
+ if ($vars['entity']->num_display == $option) {
+ $selected = "selected='selected'";
+ }
+ echo " <option value='{$option}' $selected >{$option}</option>\n";
+}
?>
- <p>
- <?php echo elgg_echo("thewire:num"); ?>
- <select name="params[num_display]">
- <option value="1" <?php if($vars['entity']->num_display == 1) echo "SELECTED"; ?>>1</option>
- <option value="2" <?php if($vars['entity']->num_display == 2) echo "SELECTED"; ?>>2</option>
- <option value="3" <?php if($vars['entity']->num_display == 3) echo "SELECTED"; ?>>3</option>
- <option value="4" <?php if($vars['entity']->num_display == 4) echo "SELECTED"; ?>>4</option>
- <option value="5" <?php if($vars['entity']->num_display == 5) echo "SELECTED"; ?>>5</option>
- <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option>
- </select>
- </p> \ No newline at end of file
+ </select>
+</p> \ No newline at end of file
diff --git a/mod/thewire/views/default/widgets/thewire/view.php b/mod/thewire/views/default/widgets/thewire/view.php
index 4821b854b..39fe368d0 100644
--- a/mod/thewire/views/default/widgets/thewire/view.php
+++ b/mod/thewire/views/default/widgets/thewire/view.php
@@ -1,29 +1,15 @@
+<?php
+
+$num = $vars['entity']->num_display;
+if (!$num) {
+ $num = 4;
+}
- <?php
+$content = elgg_list_entities(array('types' => 'object', 'subtypes' => 'thewire', 'container_guid' => $vars['entity']->owner_guid, 'limit' => $num, 'full_view' => FALSE, 'pagination' => FALSE));
- // Get any wire notes to display
- // Get the current page's owner
- $page_owner = page_owner_entity();
- if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($page_owner->getGUID());
- }
-
- $num = $vars['entity']->num_display;
- if(!$num)
- $num = 4;
-
- $thewire = $page_owner->getObjects('thewire', $num);
-
- // If there are any thewire to view, view them
- if (is_array($thewire) && sizeof($thewire) > 0) {
-
- foreach($thewire as $shout) {
-
- echo elgg_view_entity($shout);
-
- }
-
- }
-
- ?>
+echo $content;
+
+if ($content) {
+ $blogurl = $vars['url'] . "pg/thewire/" . page_owner_entity()->username;
+ echo "<div class=\"shares_widget_wrapper\"><a href=\"{$blogurl}\">".elgg_echo('thewire:moreposts')."</a></div>";
+}
diff --git a/mod/thewire/views/rss/search/object/thewire/entity.php b/mod/thewire/views/rss/search/object/thewire/entity.php
new file mode 100644
index 000000000..ff0b5b480
--- /dev/null
+++ b/mod/thewire/views/rss/search/object/thewire/entity.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Elgg thewire.
+ * Search entity view for RSS feeds.
+ *
+ * @package ElggTheWire
+ * @link http://elgg.org/
+ */
+
+if (!array_key_exists('entity', $vars)) {
+ return FALSE;
+}
+
+$owner = $vars['entity']->getOwnerEntity();
+if ($owner) {
+ $title = sprintf(elgg_echo('thewire:by'), $owner->name);
+}
+$description = $vars['entity']->getVolatileData('search_matched_description');
+
+?>
+
+<item>
+ <guid isPermaLink='false'><?php echo $vars['entity']->getGUID(); ?></guid>
+ <pubDate><?php echo date("r", $vars['entity']->time_created) ?></pubDate>
+ <link><?php echo htmlspecialchars($vars['entity']->getURL()); ?></link>
+ <title><![CDATA[<?php echo $title; ?>]]></title>
+ <description><![CDATA[<?php echo $description; ?>]]></description>
+</item>