aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-10 11:40:38 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-10 11:40:38 +0000
commit2e54eedc16240ddab2efec91e38de73f97e59710 (patch)
tree0fe82c618ad03297f8c9c92366a7e3139b12b4dd
parentae0d8fe986218116baba7fe0e20b26789bbe5e24 (diff)
downloadelgg-2e54eedc16240ddab2efec91e38de73f97e59710.tar.gz
elgg-2e54eedc16240ddab2efec91e38de73f97e59710.tar.bz2
Messages and actions: fixed!
git-svn-id: https://code.elgg.org/elgg/trunk@130 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--actions/login.php5
-rw-r--r--actions/logout.php9
-rw-r--r--engine/lib/actions.php2
-rw-r--r--engine/lib/elgglib.php35
-rw-r--r--engine/lib/users.php6
-rw-r--r--views/default/messages/list.php2
-rw-r--r--views/default/messages/messages/list.php1
-rw-r--r--views/default/pageshell.php2
8 files changed, 24 insertions, 38 deletions
diff --git a/actions/login.php b/actions/login.php
index 4c068b5f4..dbe8990fd 100644
--- a/actions/login.php
+++ b/actions/login.php
@@ -12,8 +12,6 @@
*/
// Get username and password
- //require_once('../engine/start.php');
- //global $CONFIG;
$username = get_input('username');
$password = get_input("password");
@@ -35,8 +33,5 @@
} else {
system_message("We couldn't log you in. Make sure your details are correct and please try again.");
}
-
- // header("Location: {$passthru}");
- // exit;
?> \ No newline at end of file
diff --git a/actions/logout.php b/actions/logout.php
index c75a7c30e..fd550c5a4 100644
--- a/actions/logout.php
+++ b/actions/logout.php
@@ -10,10 +10,6 @@
* @copyright Curverider Ltd 2008
* @link http://elgg.org/
*/
-
- //delete this
- require_once('../engine/start.php');
- global $CONFIG;
// Log out
$result = logout();
@@ -25,10 +21,5 @@
} else {
system_message("We couldn't log you out. We're not sure why, to be honest. Try again?");
}
-
- //direct to frontpage
- $url = $CONFIG->url;
- header("Location: {$url}");
- exit;
?> \ No newline at end of file
diff --git a/engine/lib/actions.php b/engine/lib/actions.php
index 035d26cf5..bc5d6374f 100644
--- a/engine/lib/actions.php
+++ b/engine/lib/actions.php
@@ -35,7 +35,7 @@
if (isset($CONFIG->actions[$action])) {
if ($CONFIG->actions[$action]['public'] || $_SESSION['id'] != -1) {
- if (@include($CONFIG->actions[$action]['file'])) {
+ if (@include($CONFIG->path . $CONFIG->actions[$action]['file'])) {
} else {
register_error("The requested action was not defined in the system.");
}
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 5594dc497..f7b71268a 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -189,11 +189,10 @@
*/
function page_draw($title, $body) {
-
return elgg_view('pageshell', array(
'title' => $title,
'body' => $body,
- 'messages' => system_messages(null,"")
+ 'sysmessages' => system_messages(null,"")
)
);
@@ -268,38 +267,38 @@
* @return true|false|array Either the array of messages, or a response regarding whether the message addition was successful
*/
- function system_messages($message = null, $register = "messages", $count = false) {
+ function system_messages($message = "", $register = "messages", $count = false) {
- static $messages;
- if (!isset($messages)) {
- $messages = array();
+ if (!isset($_SESSION['msg'])) {
+ $_SESSION['msg'] = array();
}
- if (!isset($messages[$register]) && !empty($register)) {
- $messages[$register] = array();
+ if (!isset($_SESSION['msg'][$register]) && !empty($register)) {
+ $_SESSION['msg'][$register] = array();
}
if (!$count) {
if (!empty($message) && is_array($message)) {
- $messages[$register] = array_merge($messages[$register], $message);
+ $_SESSION['msg'][$register] = array_merge($_SESSION['msg'][$register], $message);
+ var_export($_SESSION['msg']); exit;
return true;
} else if (!empty($message) && is_string($message)) {
- $messages[$register][] = $message;
+ $_SESSION['msg'][$register][] = $message;
return true;
- } else if (!is_string($message) && !is_array($message)) {
- if (!empty($register)) {
- $returnarray = $messages[$register];
- $messages[$register] = array();
+ } else if (is_null($message)) {
+ if ($register != "") {
+ $returnarray = $_SESSION['msg'][$register];
+ $_SESSION['msg'][$register] = array();
} else {
- $returnarray = $messages;
- $messages = array();
+ $returnarray = $_SESSION['msg'];
+ $_SESSION['msg'] = array();
}
return $returnarray;
}
} else {
if (!empty($register)) {
- return sizeof($messages[$register]);
+ return sizeof($_SESSION['msg'][$register]);
} else {
$count = 0;
- foreach($messages as $register => $submessages) {
+ foreach($_SESSION['msg'] as $register => $submessages) {
$count += sizeof($submessages);
}
return $count;
diff --git a/engine/lib/users.php b/engine/lib/users.php
index bf72fbe91..8ac667ce9 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -545,11 +545,11 @@
}
}
- register_event_handler("init","system","session_init");
+ register_event_handler("init","system","session_init");
//register actions *************************************************************
- register_action("login",true);
- register_action("logout");
+ register_action("login",true);
+ register_action("logout");
?> \ No newline at end of file
diff --git a/views/default/messages/list.php b/views/default/messages/list.php
index bac2fab56..190739a15 100644
--- a/views/default/messages/list.php
+++ b/views/default/messages/list.php
@@ -21,5 +21,5 @@
}
}
-
+
?> \ No newline at end of file
diff --git a/views/default/messages/messages/list.php b/views/default/messages/messages/list.php
index a1422bddc..b06762843 100644
--- a/views/default/messages/messages/list.php
+++ b/views/default/messages/messages/list.php
@@ -20,6 +20,7 @@
<div class="messages-errors">
<?php
+
if (!empty($vars['object']) && is_array($vars['object'])) {
foreach($vars['object'] as $message) {
echo elgg_view('messages/messages/message',array('object' => $message));
diff --git a/views/default/pageshell.php b/views/default/pageshell.php
index 06d427cb6..64e65df1a 100644
--- a/views/default/pageshell.php
+++ b/views/default/pageshell.php
@@ -37,7 +37,7 @@
<h1><?php echo $title; ?></h1>
<?php
- echo elgg_view('messages/list', array('object' => $vars['messages']));
+ echo elgg_view('messages/list', array('object' => $vars['sysmessages']));
?>
<?php echo $vars['body']; ?>