From 2e54eedc16240ddab2efec91e38de73f97e59710 Mon Sep 17 00:00:00 2001 From: ben Date: Mon, 10 Mar 2008 11:40:38 +0000 Subject: Messages and actions: fixed! git-svn-id: https://code.elgg.org/elgg/trunk@130 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/actions.php | 2 +- engine/lib/elgglib.php | 35 +++++++++++++++++------------------ engine/lib/users.php | 6 +++--- 3 files changed, 21 insertions(+), 22 deletions(-) (limited to 'engine') 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 -- cgit v1.2.3