/** * Display a comment wall. * * @param unknown_type $wall */ function commentwall_displaywall_html($wall, $showalltxt = false, $owner) { global $CFG; // $owner = page_owner(); $html = "<div id=\"commentwall_title\"><h2>" . sprintf(__gettext("%s's comment wall"), user_info("name", page_owner())) . "</h2></div>"; if ($showalltxt && $wall) { $html .= "<div id=\"commentwall_more\"><a href=\"{$CFG->wwwroot}mod/commentwall/index.php?owner={$owner}\">" . __gettext("See all...") . "</a></div>"; } // Get access permissions $access = user_flag_get("commentwall_access", $owner); if (!$access) { $access = "LOGGED_IN"; } // If no access controls set then assume public if ($owner == $_SESSION['userid'] || $access == "PUBLIC" || $access == "LOGGED_IN" && isloggedin() || $access == "FRIENDS_ONLY" && isfriend($_SESSION['userid'], $owner) || $access == "PRIVATE" && $owner == $_SESSION['userid']) { $html .= commentwall_post_form(page_owner()); if (!$wall) { $html .= "<p>" . __gettext("No comments on this wall, why not be the first?") . "</p>"; return $html; } } if (is_array($wall)) { foreach ($wall as $w) { $html .= commentwall_displaycomment($w); } } return $html; }
<?php @(require_once "../../includes.php"); global $messages, $CFG; /** * Handle comment post for non axax. */ $owner = optional_param('owner', ''); $wallowner = optional_param('wallowner', ''); $reply = optional_param('reply', ''); $returnurl = optional_param('returnurl', ''); $page = ""; $owner = page_owner(); if (empty($owner)) { $owner = -1; } global $page_owner; $page_owner = $owner; if ($reply != -1) { $title = __gettext("Post a comment"); } else { $title = __gettext("Reply to a comment"); } $html = __gettext("<p>Use this form to post a comment.</p>"); $html .= commentwall_post_form($wallowner, $reply, false, "", $returnurl); templates_page_output($title, $html);