/** * Return the IFrame URL generated by parsing the data in the URL field. * * @return string HTML code for the administration interface */ private function getGeneratedUrl() { $patterns = array('/\\{node_id\\}/', '/\\{user_id\\}/', '/\\{last_viewed\\}/'); $current_node = Node::getCurrentNode(); if ($current_node) { $node_id = $current_node->getId(); } else { $node_id = ''; } $current_user = User::getCurrentUser(); if ($current_user) { $user_id = $current_user->getId(); } else { $user_id = ''; } $user_last_viewed_ts = $this->getLastDisplayTimestamp($current_user); if ($user_last_viewed_ts) { $user_last_viewed = date('c', $user_last_viewed_ts); } else { $user_last_viewed = null; } $replacements = array(urlencode($node_id), urlencode($user_id), urlencode($user_last_viewed)); $url = $this->getUrl(); $new_url = preg_replace($patterns, $replacements, $url); return $new_url; }
/** Replace all hyperlinks in the source string with their clickthrough-logged equivalents */ public static function replaceHyperLinks(&$string, Content &$content) { $matches = self::findHyperLinks($string); //pretty_print_r($matches); if (!empty($matches[2])) { $node = Node::getCurrentNode(); $user = User::getCurrentUser(); $i = 0; foreach ($matches[2] as $link) { $new_link = self::getClickThroughLink($link, $content, $node, $user); $replacements[] = $matches[1][$i] . $new_link . $matches[3][$i]; $i++; } //pretty_print_r($replacements); return str_replace($matches[0], $replacements, $string); } else { return $string; } }
/** Log that this content has just been displayed to the user. Will only log if the user is logged in */ private function logContentDisplay() { if ($this->getLoggingStatus() == true && $this->log_as_content->getId() == $this->getId()) { // DEBUG:: //echo "Logging ".get_class($this)." :: ".$this->__toString()."<br>"; $user = User::getCurrentUser(); $node = Node::getCurrentNode(); if ($user != null && $node != null) { $user_id = $user->getId(); $node_id = $node->getId(); $db = AbstractDb::getObject(); $sql = "SELECT * FROM content_display_log WHERE content_id='{$this->id}' AND user_id='{$user_id}' AND node_id='{$node_id}'"; $db->execSql($sql, $log_rows, false); if ($log_rows != null) { $sql = "UPDATE content_display_log SET num_display = num_display +1, last_display_timestamp = CURRENT_TIMESTAMP WHERE content_id='{$this->id}' AND user_id='{$user_id}' AND node_id='{$node_id}'"; } else { $sql = "INSERT INTO content_display_log (user_id, content_id, node_id) VALUES ('{$user_id}', '{$this->id}', '{$node_id}')"; } $db->execSqlUpdate($sql, false); } } }
/** * Get the current network for which the portal is displayed or to which a * user is physically connected. * * @param bool $real_network_only NOT IMPLEMENTED YET true or false. If * true, the real physical network where the * user is connected is returned, and * the node set by setCurrentNode is ignored. * * @return objetc A Network object, NEVER returns null. * * @static * @access public */ public static function getCurrentNetwork($real_network_only = false) { $retval = null; $current_node = Node::getCurrentNode(); if ($current_node != null) { $retval = $current_node->getNetwork(); } else { $retval = Network::getDefaultNetwork(); } return $retval; }
/** Retreives the user interface of this object. Anything that overrides this method should call the parent method with it's output at the END of processing. * @return The HTML fragment for this interface */ public function getUserUI() { $real_node = Node::getCurrentRealNode(); //For production //$real_node = Node::getCurrentNode();//For testing $node = Node::getCurrentNode(); $formHtml = null; if ($real_node) { $formHtml .= "<form action='" . BASE_URL_PATH . "content/ShoutBox/add_message.php'>\n"; $formHtml .= "<input type='hidden' name='shoutbox_id' value='" . $this->getId() . "'/>\n"; //$html .= "destination_url: ";pretty_print_r($_SERVER); $maxShoutChars = $this->getMaxShoutChars(); $shoutFieldSize = $this->getShoutFieldSize(); if ($maxShoutChars > 0) { $max_size = "maxlength='{$maxShoutChars}'"; $maxShoutChars <= $shoutFieldSize ? $size = "size='{$maxShoutChars}'" : ($size = "size='{$shoutFieldSize}'"); } else { $max_size = null; $size = "size='{$shoutFieldSize}'"; } $formHtml .= "<input type='hidden' name='node_id' value='" . $node->getId() . "'/>\n"; $formHtml .= "<input type='text' name='shout_text' id='shout_text' {$size} {$max_size} value=''/>\n"; $onclick_content = $this->getOnClickContent(); if ($onclick_content) { $onclick = "onclick=\"" . $onclick_content->getString() . "\""; } else { $onclick = null; } $formHtml .= "<input type='submit' name='shout_submit' {$onclick} value='" . _("Shout!") . "'>\n"; $formHtml .= "</form>\n"; } else { $formHtml .= "<p>" . _("Sorry, you must be at a hotspot to use the shoutbox") . "</p>\n"; } $html_main = ''; $displayNumItems = $this->getDisplayNumItems(); $db = AbstractDb::getObject(); if ($node) { $node_id = $db->escapeString($node->getId()); if ($displayNumItems > 0) { $limit = "LIMIT {$displayNumItems}"; $heading = "<em>" . sprintf(_("Last %d messages:"), $displayNumItems) . "</em>"; } else { $limit = null; $heading = null; } $sql = "SELECT *, EXTRACT(EPOCH FROM creation_date) as creation_date_php FROM content_shoutbox_messages WHERE origin_node_id='{$node_id}' ORDER BY creation_date DESC {$limit}\n"; $db->execSql($sql, $rows, false); $html_main .= "<ul>"; $html_main .= "<li>{$formHtml}</li>"; if ($rows) { //$html_main .= $heading; foreach ($rows as $row) { $user = User::getObject($row['author_user_id']); $content = Content::getObject($row['message_content_id']); $html_main .= "<li>"; $dateStr = "<span class='date'>" . strftime('%x', $row['creation_date_php']) . "</span>\n"; $html_main .= $dateStr . ' ' . $user->getListUI() . ": \n"; $html_main .= "<div class='message'>" . $content->getListUI() . "</div>\n"; $html_main .= "</li>"; } } $html_main .= "</ul>"; } else { $html_main .= "<p>" . _("Sorry, I am unable to determine your current node") . "</p>\n"; } $this->setUserUIMainDisplayContent($html_main); //$this->setUserUIMainInteractionArea($formHtml); return Content::getUserUI(); }
/** * Retreives the user interface of this object. * * Anything that overrides this method should call the parent method with * it's output at the END of processing. * @return string The HTML fragment for this interface */ public function getUserUI() { // Init values $current_node = Node::getCurrentNode(); $smarty = SmartyWifidog::getObject(); // Set details about onlineusers if ($current_node) { // online users $online_users = $current_node->getOnlineUsers(); foreach ($online_users as $online_user) { $online_user_array[] = $online_user->getListUI(); } $num_online_users = count($online_users); if ($num_online_users > 0) { $smarty->assign('onlineUsers', $online_user_array); } else { $smarty->assign('onlineUsers', array()); } // recent users $recent_users = $current_node->getRecentUsers(); foreach ($recent_users as $recent_user) { $recent_user_array[] = $recent_user->getListUI(); } $num_recent_users = count($recent_users); if ($num_recent_users > 0) { $smarty->assign('recentUsers', $recent_user_array); } else { $smarty->assign('recentUsers', array()); } // active users $active_users = $current_node->getActiveUsers(); foreach ($active_users as $active_user) { $active_user_array[] = $active_user->getListUI(); } $num_active_users = count($active_users); if ($num_active_users > 0) { $smarty->assign('activeUsers', $active_user_array); } else { $smarty->assign('activeUsers', array()); } // Compile HTML code $html = $smarty->fetch("templates/classes/UIUserList_getUserUI.tpl"); } else { $html = _("The online user list must be viewed at a specific node"); } $this->setUserUIMainDisplayContent($html); return Content::getUserUI(); }
/** Retrieves the connection history necessary for abuse control * @return false if abuse control is disabled */ static function getAbuseControlConnectionHistory($user = null, $mac = null, $node = null) { if (!$user) { $user = User::getCurrentUser(); } if (!$node) { $node = Node::getCurrentNode(); //Maybe this should be getCurrentRealNode, but it would make debuging harder } $network = $node->getNetwork(); $db = AbstractDb::getObject(); if ($network->getConnectionLimitWindow()) { //$sql = " SELECT * from connections \n";//For debugging $sql = " SELECT \n"; $sql .= " SUM (incoming+outgoing) AS network_total_bytes, \n"; $sql .= " SUM (CASE WHEN node_id = '" . $node->getId() . "' THEN (incoming+outgoing) END) AS node_total_bytes, \n"; $sql .= " SUM (COALESCE(timestamp_out,last_updated) - timestamp_in) AS network_duration, \n"; $sql .= " SUM (CASE WHEN node_id = '" . $node->getId() . "' THEN (COALESCE(timestamp_out,last_updated) - timestamp_in) END) AS node_duration \n"; //For real //The coalesce is to make sure the substraction returns a value for active conections, since active connections do not yet have a timestamp_out. Do NOT coalesce with CURRENT_TIMESTAMP, it could cause real problems for users in case of gateway crash. $sql .= " FROM connections \n"; //For real $sql .= " JOIN nodes USING (node_id) \n"; $sql .= " JOIN networks USING (network_id) \n"; $sql .= " JOIN tokens ON (tokens.token_id = connections.token_id) \n"; $sql .= " WHERE 1=1 \n"; if ($mac) { //Catch some cheaters $mac = $db->escapeString($mac); $mac_sql_or = " OR connections.user_mac = '{$mac}' "; } else { $mac_sql_or = null; } $sql .= " AND (connections.user_id = '" . $user->getId() . "' {$mac_sql_or} ) \n"; $sql .= " AND (timestamp_in > CURRENT_TIMESTAMP - networks.connection_limit_window OR tokens.token_status = '" . TOKEN_INUSE . "')"; //Get every connection within the window plus any still active connection, even if it started before the window $subselect = $sql; $sql = " SELECT subselect.*, \n"; $sql .= " networks.connection_limit_window, \n"; $sql .= " networks.connection_limit_network_max_total_bytes, COALESCE(network_total_bytes>networks.connection_limit_network_max_total_bytes, false) AS network_total_bytes_exceeded_limit, \n"; $sql .= " networks.connection_limit_node_max_total_bytes, COALESCE(node_total_bytes>networks.connection_limit_node_max_total_bytes, false) AS node_total_bytes_exceeded_limit, \n"; $sql .= " networks.connection_limit_network_max_usage_duration, COALESCE(network_duration>networks.connection_limit_network_max_usage_duration, false) AS network_duration_exceeded_limit, \n"; $sql .= " networks.connection_limit_node_max_usage_duration, COALESCE(node_duration>networks.connection_limit_node_max_usage_duration, false) AS node_duration_exceeded_limit \n"; $sql .= " FROM ({$subselect}) AS subselect JOIN networks ON (network_id = '" . $network->getId() . "')"; $db->execSqlUniqueRes($sql, $connection_limits_report, false); return $connection_limits_report; } else { return false; } }
function getDisplayElements() { //This function is very expensive, cache the results if (!is_array($this->display_elements)) { $db = AbstractDb::getObject(); // Init values $retval = array(); $user = User::getCurrentUser(); $redisplay_rows = null; $last_order_row = null; $element_rows = null; if ($user) { $user_id = $user->getId(); } else { $user_id = ''; } $node = Node::getCurrentNode(); if ($node) { $node_id = $node->getId(); } else { $node_id = ''; } $display_num_elements = $this->getDisplayNumElements(); /* 'ALWAYS' => "Content always rotates" * 'NEXT_DAY' => "Content rotates once per day" * 'NEXT_LOGIN' => "Content rotates once per session" * 'NEXT_NODE' => "Content rotates each time you change node" * 'NEVER' => "Content never rotates" */ $content_changes_on_mode = $this->getContentChangesOnMode(); $sql_time_restrictions = " AND (valid_from_timestamp IS NULL OR valid_from_timestamp <= CURRENT_TIMESTAMP) AND (valid_until_timestamp IS NULL OR valid_until_timestamp >= CURRENT_TIMESTAMP) \n"; /** First, find if we have content to display again because we haven't passed the rotation period */ $redisplay_objects = array(); $sql_redisplay = null; if ($content_changes_on_mode != 'ALWAYS' && $content_changes_on_mode != 'NEVER') { $sql_redisplay .= "SELECT content_group_element_id FROM content_group_element \n"; $sql_redisplay .= "JOIN content_display_log ON (content_group_element_id=content_id) \n"; $sql_redisplay .= " WHERE content_group_id='{$this->id}' \n"; $sql_redisplay .= $sql_time_restrictions; if ($content_changes_on_mode == 'NEXT_DAY') { $sql_redisplay .= "AND date_trunc('day', last_display_timestamp) = date_trunc('day', CURRENT_DATE) \n"; } if ($content_changes_on_mode == 'NEXT_LOGIN') { /**@todo Must fix, this will fail if the user never really connected from a hotspot... */ $sql_redisplay .= "AND last_display_timestamp > (SELECT timestamp_in FROM connections WHERE user_id='{$user_id}' ORDER BY timestamp_in DESC LIMIT 1) \n"; } if ($content_changes_on_mode == 'NEXT_NODE') { /** We find the close time of the last connection from another node */ $sql_redisplay .= "AND last_display_timestamp > (SELECT timestamp_out FROM connections WHERE user_id='{$user_id}' AND node_id != '{$node_id}' ORDER BY timestamp_in DESC LIMIT 1) \n"; } /* There usually won't be more than one, but if there is, we want the most recents */ $sql_redisplay .= " ORDER BY last_display_timestamp DESC "; $db->execSql($sql_redisplay, $redisplay_rows, false); $redisplay_objects = array(); if ($redisplay_rows != null) { foreach ($redisplay_rows as $redisplay_row) { $object = self::getObject($redisplay_row['content_group_element_id']); if ($object->isDisplayableAt(Node::GetCurrentNode()) == true) { $redisplay_objects[] = $object; } } } /* Pick the proper number of elements to be re-displayed */ $redisplay_objects = array_slice($redisplay_objects, 0, $display_num_elements); } $new_objects = array(); if (count($redisplay_objects) < $display_num_elements) { /* There aren't enough elements to redisplay, We need new content */ /*'YES' => "Content can be shown more than once", 'NO' => "Content can only be shown once", 'ONCE_PER_NODE' => "Content can be shown more than once, but not at the same node"*/ $allow_repeat = $this->getAllowRepeat(); if ($allow_repeat == 'NO') { $sql_repeat_join = " LEFT JOIN content_display_log ON (content_group_element_id = content_display_log.content_id AND content_display_log.user_id = '{$user_id}') \n"; $sql_repeat = " AND content_display_log.content_id IS NULL \n"; } elseif ($allow_repeat == 'ONCE_PER_NODE') { $sql_repeat_join = " LEFT JOIN content_display_log ON (content_group_element_id = content_display_log.content_id AND content_display_log.user_id = '{$user_id}' AND content_display_log.node_id = '{$node_id}') \n"; $sql_repeat = " AND content_display_log.content_id IS NULL \n"; } else { $sql_repeat_join = null; $sql_repeat = null; } $sql = "SELECT content_group_element_id FROM content_group_element {$sql_repeat_join} WHERE content_group_id='{$this->id}' \n"; $sql .= $sql_time_restrictions; $sql .= $sql_repeat; if ($sql_redisplay) { //We don't want the same content twice... $sql_repeat_redisplay = " AND content_group_element_id NOT IN ({$sql_redisplay}) \n"; $sql .= $sql_repeat_redisplay; } $content_ordering_mode = $this->getContentOrderingMode(); if ($content_ordering_mode == 'SEQUENTIAL') { $order_by = ' ORDER BY display_order '; //Find the last content displayed $sql_last_order = "SELECT display_order FROM content_group_element \n"; $sql_last_order .= "JOIN content_display_log ON (content_group_element_id=content_id) \n"; $sql_last_order .= " WHERE content_group_id='{$this->id}' \n"; $sql_last_order .= " AND user_id='{$user_id}' \n"; $sql_last_order .= " ORDER BY last_display_timestamp DESC LIMIT 1"; $db->execSqlUniqueRes($sql_last_order, $last_order_row, false); if ($last_order_row['display_order'] != null) { $last_order = $last_order_row['display_order']; } else { $last_order = 0; } } else { $order_by = ' '; $last_order = 0; } $sql .= $order_by; $element_rows = null; if ($content_ordering_mode == 'PSEUDO_RANDOM') { //Special case, first get only the rows that haven't been displayed before' $sql_no_repeat_join = " LEFT JOIN content_display_log ON (content_group_element_id = content_display_log.content_id AND content_display_log.user_id = '{$user_id}') \n"; $sql_no_repeat_and = " AND content_display_log.content_id IS NULL \n"; $sql_no_repeat = "SELECT content_group_element_id FROM content_group_element {$sql_no_repeat_join} WHERE content_group_id='{$this->id}' {$sql_no_repeat_and} \n"; $db->execSql($sql_no_repeat, $element_rows, false); } //Normal case, or there wasn't any undisplayed content in PSEUDO_RANDOM if ($element_rows == null) { $db->execSql($sql, $element_rows, false); } if ($element_rows == null) { $element_rows = array(); } foreach ($element_rows as $element_row) { $object = self::getObject($element_row['content_group_element_id']); if ($object->isDisplayableAt(Node::GetCurrentNode()) == true) { $new_objects[] = $object; } } if ($content_ordering_mode == 'RANDOM' || $content_ordering_mode == 'PSEUDO_RANDOM') { shuffle($new_objects); } elseif ($content_ordering_mode == 'SEQUENTIAL') { foreach ($new_objects as $object) { if ($object->getDisplayOrder() <= $last_order) { array_push($new_objects, array_shift($new_objects)); //echo " Pushed ".$object->getDisplayOrder(); } } } /** Pick the proper number of elements */ $num_to_pick = $display_num_elements - count($redisplay_objects); $new_objects = array_slice($new_objects, 0, $num_to_pick); } /*echo "<pre>Redisplay: "; print_r($redisplay_objects); echo "New objects: "; print_r($new_objects); echo "</pre>";*/ $retval = array_merge($new_objects, $redisplay_objects); //echo count($retval).' returned <br>'; $this->display_elements = $retval; } return $this->display_elements; }
/** * Add the content marked "everywhere" from both the current node and the * current network. * * @return void */ private function addEverywhereContent() { $db = AbstractDb::getObject(); // Get all network content and node "everywhere" content $content_rows = null; $node = Node::getCurrentNode(); // Get all the parent objects of the node if ($node) { $parents = HotspotGraph::getAllParents($node); } else { $parents = array(Network::getCurrentNetwork()->getHgeId()); } $first = $db->escapeString(array_shift($parents)); $sql_from = "(SELECT content_id, display_area, display_order, subscribe_timestamp \n \t\t\tFROM hotspot_graph_element_has_content hgehc \n \t\t\tWHERE hotspot_graph_element_id='{$first}' AND display_page='everywhere')"; // Get the contents for all elements parents of and including the node, but exclude user subscribed content if user is known foreach ($parents as $parentid) { $parent_id = $db->escapeString($parentid); $sql_from .= " UNION (SELECT content_id, display_area, display_order, subscribe_timestamp \n \t\t\tFROM hotspot_graph_element_has_content hgehc \n \t\t\tWHERE hotspot_graph_element_id='{$parent_id}' AND display_page='everywhere')"; } $sql = "SELECT * FROM ({$sql_from}) AS content_everywhere ORDER BY display_area, display_order, subscribe_timestamp DESC"; $db->execSql($sql, $content_rows, false); if ($content_rows) { foreach ($content_rows as $content_row) { $content = Content::getObject($content_row['content_id']); if ($content->isDisplayableAt($node)) { $this->addContent($content_row['display_area'], $content, $content_row['display_order']); } } } }
/** * Retreives the user interface of this object. * * Anything that overrides this method should call the parent method with * it's output at the END of processing. * @return string The HTML fragment for this interface */ public function getUserUI() { // Init values $current_node = Node::getCurrentNode(); $smarty = SmartyWifidog::getObject(); $html = null; $user = User::getCurrentUser(); if ($user) { if ($current_node) { $abuseControlReport = User::getAbuseControlConnectionHistory($user, null, $current_node); if ($abuseControlReport) { //pretty_print_r($abuseControlReport); $db = AbstractDb::getObject(); $html .= sprintf(_("During the last %s period, you transfered %s / %s and were connected %s / %s at this node. Throughout the network, you transfered %s / %s and were connected %s / %s"), $abuseControlReport['connection_limit_window'] ? $db->GetIntervalStrFromDurationArray($db->GetDurationArrayFromIntervalStr($abuseControlReport['connection_limit_window'])) : _("Unknown"), self::formatSize($abuseControlReport['node_total_bytes']), $abuseControlReport['connection_limit_node_max_total_bytes'] ? self::formatSize($abuseControlReport['connection_limit_node_max_total_bytes']) : _("Unlimited"), $abuseControlReport['node_duration'] ? $db->GetIntervalStrFromDurationArray($db->GetDurationArrayFromIntervalStr($abuseControlReport['node_duration'])) : _("None"), $abuseControlReport['connection_limit_node_max_usage_duration'] ? $abuseControlReport['connection_limit_node_max_usage_duration'] : _("Unlimited"), self::formatSize($abuseControlReport['network_total_bytes']), $abuseControlReport['connection_limit_network_max_total_bytes'] ? self::formatSize($abuseControlReport['connection_limit_network_max_total_bytes']) : _("Unlimited"), $abuseControlReport['network_duration'] ? $db->GetIntervalStrFromDurationArray($db->GetDurationArrayFromIntervalStr($abuseControlReport['network_duration'])) : _("None"), $abuseControlReport['connection_limit_network_max_usage_duration'] ? $abuseControlReport['connection_limit_network_max_usage_duration'] : _("Unlimited")); } else { $html .= _("Abuse control is currently disabled"); } } else { $html .= _("Unable to retrieve node specific restrictions (you are not at a node)"); } $this->setUserUIMainDisplayContent($html); return Content::getUserUI(); } }
/** * Logs out the user * * @param string $conn_id The connection id for the connection to work on. * If it is not present, the behaviour depends if * the network supports multiple logins. If it does * not, all connections associated with the current * user will be destroyed. If it does, only the * connections tied to the current node will be * destroyed. * * @return void */ public function logout($conn_id = null) { $db = AbstractDb::getObject(); $session = Session::getObject(); $conn_id = $db->escapeString($conn_id); if (!empty($conn_id)) { $db->execSqlUniqueRes("SELECT CURRENT_TIMESTAMP, *, CASE WHEN ((CURRENT_TIMESTAMP - reg_date) > networks.validation_grace_time) THEN true ELSE false END AS validation_grace_time_expired FROM connections JOIN users ON (users.user_id=connections.user_id) JOIN networks ON (users.account_origin = networks.network_id) WHERE connections.conn_id='{$conn_id}'", $info, false); $user = User::getObject($info['user_id']); $network = $user->getNetwork(); $splash_user_id = $network->getSplashOnlyUser()->getId(); $this->acctStop($conn_id); } else { $user = User::getCurrentUser(); $network = $user->getNetwork(); $splash_user_id = $network->getSplashOnlyUser()->getId(); if ($splash_user_id != $user->getId() && ($node = Node::getCurrentNode())) { // Try to destroy all connections tied to the current node $sql = "SELECT conn_id FROM connections JOIN tokens USING (token_id) WHERE user_id = '{$user->getId()}' AND node_id='{$node->getId()}' AND token_status='" . TOKEN_INUSE . "';"; $conn_rows = null; $db->execSql($sql, $conn_rows, false); if ($conn_rows) { foreach ($conn_rows as $conn_row) { $this->acctStop($conn_row['conn_id']); } } } } if ($splash_user_id != $user->getId() && $network->getMultipleLoginAllowed() === false) { /* * The user isn't the splash_only user and the network config does * not allow multiple logins. Logging in with a new token implies * that all other active tokens should expire */ $sql = "SELECT conn_id FROM connections JOIN tokens USING (token_id) WHERE user_id = '{$user->getId()}' AND token_status='" . TOKEN_INUSE . "';"; $conn_rows = null; $db->execSql($sql, $conn_rows, false); if ($conn_rows) { foreach ($conn_rows as $conn_row) { $this->acctStop($conn_row['conn_id']); } } } // Try to destroy current session // TODO: This will not work if ultimately called from the gateway (ex: after abuse control was reached). This creates a UI problem (the portal still shows the user as connected) if (method_exists($session, "destroy")) { $session->destroy(); } }
public function formatEvent($event, $info = null) { $dt = date("Y-m-d H:i:s (T)", $event->getTimestamp()); $myFilename = $event->getFilename(); $myLinenum = $event->getLinenum(); // Get information about node $myCurrentNode = Node::getCurrentNode(); if (empty($myCurrentNode)) { $myNodeName = '*nonode*'; } else { $myNodeName = $myCurrentNode->getName(); } // Get information about network $myNetwork = Network::getCurrentNetwork(); if (empty($myNetwork)) { $myNetworkName = '*nonetwork*'; } else { $myNetworkName = $myNetwork->getName(); } // Get information about user $myCurrentUser = User::getCurrentUser(); if (empty($myCurrentUser)) { $myUserName = '******'; } else { $myUserName = $myCurrentUser->getUsername(); } $string = "{$dt} " . EventObject::PrettyErrorType($event->getLayoutType()) . " >{$myNetworkName} >{$myUserName}@{$myNodeName} [" . $_SERVER['REQUEST_URI'] . "]" . ": " . $event->getMessage() . (!empty($myFilename) ? " in {$myFilename}" . (!empty($myLinenum) ? " on line {$myLinenum}" : "") : "") . "\n"; if ($event->classifyErrorType() == 'error') { $string .= " Stack Backtrace\n" . self::FormatBacktrace($event->getContext()) . "\n"; } return $string; }