* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * The lastest version of Cyberspace Networks CoreSystem can be obtained from: * https://github.com/CyberspaceNetworks/CoreSystem * For questions, help, comments, discussion, etc. please visit * http://www.cyberspace-networks.com * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ $login_required = TRUE; include_once "web/includes/cnpage.php"; require_once "api/CNTheme/CNTemplate.php"; require_once "api/CNLogin/CNLogin.php"; require_once "web/includes/classes/CNUrlHelper.php"; // if return url is set in the request then after logout redirect to the location else redirect to homepage. if (!empty($_REQUEST['return'])) { $return = $_REQUEST['return']; } else { // build rthe url via CNUrlHelper so we can respect the SSL directives $return = CNUrlHelper::url_for(PA::$url . '/' . FILE_LOGIN, array(), 'https'); } // destroy the login cookie PA_Login::log_out(); // invalidate the cache for user profile $file = PA::$theme_url . "/cnuser_profile.php?uid=" . PA::$login_uid; CachedTemplate::invalidate_cache($file); // kill the session $_SESSION = array(); session_destroy(); session_start(); // and go home :) header("Location: {$return}"); exit;
} // redirect user if ($return_url) { // header("Location: ". PA::$url ."/$return_url");exit; // $return_url should already have the correct path header("Location: {$return_url}"); exit; } else { header("Location: " . PA::$url . "{$location}"); exit; } } else { // if user is not authenticated $msg = !empty($msg) ? $msg : 'Error: Invalid login name or password'; // $r = PA::$url.'/cnuser_login.php?msg='.$msg; $r = CNUrlHelper::url_for(PA::$url . '/cnuser_login.php', array('msg' => $msg), 'https'); if ($invitation_id) { $r .= "&InvID={$invitation_id}"; } else { if ($group_invitation_id) { $r .= "&GInvID={$group_invitation_id}"; } } if ($token) { $r .= "&token={$token}"; } if ($return_url) { $r .= "&return={$return_url}"; } header("Location:{$r}"); exit;
<div class="navbar-custom-menu"> <ul class="nav navbar-nav"> <!-- User Account: style can be found in dropdown.less --> <?php if (!isset($_SESSION['user'])) { ?> <li><a href="<?php echo CNUrlHelper::url_for(PA::$url . "/cnuser_login.php", array(), "https"); ?> "><?php echo __("Login now"); ?> </a></li> <li><a href="<?php echo CNUrlHelper::url_for(PA::$url . "/cnuser_register.php", array(), "https"); ?> "><?php echo __("Register"); ?> </a></li> <?php } else { $login_user = PA::$login_user; $user_name = $login_user->first_name . " " . $login_user->last_name; ?> <!-- Messages: style can be found in dropdown.less--> <li class="dropdown messages-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-envelope-o"></i>
public function getMessageSpecificData() { if (is_array($this->associated_obj)) { // to keep compatibility with some old code, we must accept parameters given in arrays also foreach ($this->associated_obj as $name => $value) { $this->template_vars["%{$name}%"] = $value; } } else { if (is_object($this->associated_obj)) { if (is_a($this->associated_obj, 'User')) { $this->addUserData($this->associated_obj, 'related.user'); } else { if (is_a($this->associated_obj, 'Content')) { $author = new User(); $author->load((int) $this->associated_obj->author_id); $this->addUserData($author, 'content.author'); $this->template_vars["%content.title%"] = $this->associated_obj->title; $this->template_vars["%content.url%"] = CNUrlHelper::url_for(PA_ROUTE_CONTENT, array('cid' => $this->associated_obj->content_id)); $this->template_vars["%content.link%"] = CNUrlHelper::link_to(PA_ROUTE_CONTENT, $this->associated_obj->title, null, array('cid' => $this->associated_obj->content_id)); $this->template_vars["%content.delete_url%"] = CNUrlHelper::url_for(PA_ROUTE_CONTENT, array('cid' => $this->associated_obj->content_id, 'action' => 'deleteContent')); $this->template_vars["%content.delete_link%"] = CNUrlHelper::link_to(PA_ROUTE_CONTENT, $this->template_vars["%content.delete_url%"], null, array('cid' => $this->associated_obj->content_id, 'action' => 'deleteContent')); $this->template_vars["%content.moderation_url%"] = CNUrlHelper::url_for(PA::$url . '/' . FILE_NETWORK_MANAGE_CONTENT); $this->template_vars["%content.moderation_link%"] = CNUrlHelper::link_to(PA::$url . '/' . FILE_NETWORK_MANAGE_CONTENT, $this->template_vars["%content.moderation_url%"]); if (get_class($this->associated_obj) == 'Image' || get_class($this->associated_obj) == 'Audio' || get_class($this->associated_obj) == 'Video') { if (!empty($this->associated_obj->group_id)) { // if Group Media $this->group = new Group(); $this->group->load((int) $this->associated_obj->group_id); $this->addGroupData($this->group); } $this->template_vars["%media.title%"] = $this->associated_obj->title; $this->template_vars["%media.full_view_url%"] = CNUrlHelper::url_for(PA::$url . '/' . FILE_MEDIA_FULL_VIEW, array('cid' => $this->associated_obj->content_id, 'login_required' => 'true')); $this->template_vars["%media.full_view_link%"] = CNUrlHelper::link_to(PA::$url . '/' . FILE_MEDIA_FULL_VIEW, $this->template_vars["%media.full_view_url%"], null, array('cid' => $this->associated_obj->content_id, 'login_required' => 'true')); } } else { if (is_a($this->associated_obj, 'Comment')) { $author = new User(); $author->load((int) $this->associated_obj->user_id); $this->addUserData($author, 'comment.author'); $this->template_vars["%comment.text%"] = $this->associated_obj->comment; $this->template_vars["%comment.url%"] = CNUrlHelper::url_for(PA_ROUTE_CONTENT, array('cid' => $this->associated_obj->content_id)); $this->template_vars["%comment.link%"] = CNUrlHelper::link_to(PA_ROUTE_CONTENT, $this->template_vars["%comment.url%"], null, array('cid' => $this->associated_obj->content_id)); $this->template_vars["%comment.delete_url%"] = CNUrlHelper::url_for(PA::$url . '/deletecomment.php', array('comment_id' => $this->associated_obj->comment_id)); $this->template_vars["%comment.delete_link%"] = CNUrlHelper::link_to(PA::$url . '/deletecomment.php', $this->template_vars["%comment.delete_url%"], null, array('comment_id' => $this->associated_obj->comment_id)); } else { if (is_a($this->associated_obj, 'Invitation')) { $inviter = new User(); $inviter->load((int) $this->associated_obj->user_id); $this->addUserData($inviter, 'invite.inviter'); if (!empty($this->associated_obj->inv_collection_id) && $this->associated_obj->inv_collection_id != -1) { $group = new Group(); $group->load((int) $this->associated_obj->inv_collection_id); $this->group = $group; $this->addGroupData($this->group); } if (empty($this->associated_obj->inv_user_id) || $this->associated_obj->inv_summary == "internal_invitation") { // invitation sent $reg_link_desc = abbreviate_text($this->associated_obj->register_url, 52, 36); $acc_link_desc = abbreviate_text($this->associated_obj->accept_url, 52, 36); $reg_link = "<a href=\"{$this->associated_obj->register_url}\">{$reg_link_desc}</a>"; $acc_link = "<a href=\"{$this->associated_obj->accept_url}\">{$acc_link_desc}</a>"; $this->template_vars["%invite.message%"] = $this->associated_obj->inv_message; $this->template_vars["%invite.accept_url%"] = $this->associated_obj->accept_url; $this->template_vars["%invite.accept_link%"] = $acc_link; $this->template_vars["%invite.register_url%"] = $this->associated_obj->register_url; $this->template_vars["%invite.register_link%"] = $reg_link; $this->template_vars["%invite.invited_user_name%"] = $this->associated_obj->inv_user_first_name; $this->template_vars["%invite.invited_user_email%"] = $this->associated_obj->inv_email; $this->template_vars["%recipient.email_address%"] = $this->associated_obj->inv_email; } else { // invitation accepted $invited = new User(); $invited->load((int) $this->associated_obj->inv_user_id); $this->addUserData($invited, 'invite.invited'); if (!empty($this->associated_obj->inv_relation_type)) { $this->template_vars["%invite.relation_type%"] = $this->associated_obj->inv_relation_type; } } } else { if (is_a($this->associated_obj, 'RelationData')) { $requester = new User(); $relateduser = new User(); $requester->load((int) $this->associated_obj->user_id); $relateduser->load((int) $this->associated_obj->relation_id); $this->addUserData($requester, 'relation.inviter'); $this->addUserData($relateduser, 'relation.invited'); $this->template_vars["%relation.type%"] = Relation::lookup_relation_type($this->associated_obj->relationship_type); $this->template_vars["%relation.friend_list_url%"] = CNUrlHelper::url_for(PA::$url . '/' . FILE_VIEW_ALL_MEMBERS, array('view_type' => 'in_relations', 'uid' => $this->associated_obj->user_id, 'login_required' => 'true')); $this->template_vars["%relation.friend_list_link%"] = CNUrlHelper::link_to(PA::$url . '/' . FILE_VIEW_ALL_MEMBERS, $this->template_vars["%relation.friend_list_url%"], null, array('view_type' => 'in_relations', 'uid' => $this->associated_obj->user_id, 'login_required' => 'true')); $this->template_vars["%relation.appr_deny_url%"] = CNUrlHelper::url_for(PA::$url . '/' . FILE_VIEW_ALL_MEMBERS, array('view_type' => 'in_relations', 'uid' => $this->associated_obj->relation_id, 'login_required' => 'true')); $this->template_vars["%relation.appr_deny_link%"] = CNUrlHelper::link_to(PA::$url . '/' . FILE_VIEW_ALL_MEMBERS, $this->template_vars["%relation.appr_deny_url%"], null, array('view_type' => 'in_relations', 'uid' => $this->associated_obj->relation_id, 'login_required' => 'true')); } else { if (is_a($this->associated_obj, 'ReportAbuse')) { $author = new User(); $author->load((int) $this->associated_obj->reporter_id); $this->addUserData($author, 'abuse.reporter'); $this->template_vars["%abuse.report%"] = $this->associated_obj->body; $this->template_vars["%abuse.url%"] = CNUrlHelper::url_for(PA_ROUTE_CONTENT, array('cid' => $this->associated_obj->parent_id)); $this->template_vars["%abuse.link%"] = CNUrlHelper::link_to(PA_ROUTE_CONTENT, $this->template_vars["%abuse.url%"], null, array('cid' => $this->associated_obj->parent_id)); $this->template_vars["%abuse.delete_comment_url%"] = CNUrlHelper::url_for(PA::$url . '/deletecomment.php', array('comment_id' => $this->associated_obj->parent_id)); $this->template_vars["%abuse.delete_comment_link%"] = CNUrlHelper::link_to(PA::$url . '/deletecomment.php', $this->template_vars["%abuse.delete_comment_url%"], null, array('comment_id' => $this->associated_obj->parent_id)); $this->template_vars["%abuse.delete_content_url%"] = CNUrlHelper::url_for(PA::$url . '/deletecontent.php', array('cid' => $this->associated_obj->parent_id)); $this->template_vars["%abuse.delete_content_link%"] = CNUrlHelper::link_to(PA::$url . '/deletecontent.php', $this->template_vars["%abuse.delete_content_url%"], null, array('cid' => $this->associated_obj->parent_id)); } else { if (is_a($this->associated_obj, 'Group')) { $this->addGroupData($this->associated_obj); } else { Logger::log("Error exit: function MessageRenderer::getMessageSpecificData() - Unknown associated object type."); throw new Exception("MessageRenderer::getMessageSpecificData() - Unknown associated object type."); } } } } } } } } } }