mirror of
https://github.com/moodle/moodle.git
synced 2025-04-27 03:14:20 +02:00
Now RSS links ae showed properly in SITE course when
user isn't logged. Solve a problem with if($USER) under PHP5.
This commit is contained in:
parent
cc7716b382
commit
f4646b44c1
@ -45,12 +45,13 @@
|
||||
$generaltable->head = array ($strforum, $strdescription, $strdiscussions);
|
||||
$generaltable->align = array ("left", "left", "center");
|
||||
|
||||
if ($can_subscribe = (isstudent($course->id) or isteacher($course->id) or isadmin() or $course->id == SITEID)) {
|
||||
if ($can_subscribe = (isstudent($course->id) or isteacher($course->id) or isadmin())) {
|
||||
$generaltable->head[] = $strsubscribed;
|
||||
$generaltable->align[] = "center";
|
||||
}
|
||||
|
||||
if ($show_rss = ($can_subscribe && isset($CFG->enablerssfeeds) && isset($CFG->forum_enablerssfeeds) &&
|
||||
if ($show_rss = (($can_subscribe || $course->id == SITEID) &&
|
||||
isset($CFG->enablerssfeeds) && isset($CFG->forum_enablerssfeeds) &&
|
||||
$CFG->enablerssfeeds && $CFG->forum_enablerssfeeds)) {
|
||||
$generaltable->head[] = $strrss;
|
||||
$generaltable->align[] = "center";
|
||||
@ -135,6 +136,26 @@
|
||||
$forumlink = "<a class=\"dimmed\" href=\"view.php?f=$forum->id\">$forum->name</a>";
|
||||
}
|
||||
|
||||
//If this forum has RSS activated, calculate it
|
||||
$rsslink = '';
|
||||
if ($show_rss) {
|
||||
if ($forum->rsstype and $forum->rssarticles) {
|
||||
//Calculate the tolltip text
|
||||
if ($forum->rsstype == 1) {
|
||||
$tooltiptext = get_string("rsssubscriberssdiscussions","forum",$forum->name);
|
||||
} else {
|
||||
$tooltiptext = get_string("rsssubscriberssposts","forum",$forum->name);
|
||||
}
|
||||
if (empty($USER->id)) {
|
||||
$userid = 0;
|
||||
} else {
|
||||
$userid = $USER->id;
|
||||
}
|
||||
//Get html code for RSS link
|
||||
$rsslink = rss_get_link($course->id, $userid, "forum", $forum->id, $tooltiptext);
|
||||
}
|
||||
}
|
||||
|
||||
if ($can_subscribe) {
|
||||
if (forum_is_forcesubscribed($forum->id)) {
|
||||
$sublink = get_string("yes");
|
||||
@ -153,26 +174,20 @@
|
||||
$sublink = "<a title=\"$subtitle\" href=\"subscribe.php?id=$forum->id\">$subscribed</a>";
|
||||
}
|
||||
}
|
||||
//If this forum has RSS activated, calculate it
|
||||
if ($show_rss) {
|
||||
$rsslink = '';
|
||||
if ($forum->rsstype and $forum->rssarticles) {
|
||||
//Calculate the tolltip text
|
||||
if ($forum->rsstype == 1) {
|
||||
$tooltiptext = get_string("rsssubscriberssdiscussions","forum",$forum->name);
|
||||
} else {
|
||||
$tooltiptext = get_string("rsssubscriberssposts","forum",$forum->name);
|
||||
}
|
||||
//Get html code for RSS link
|
||||
$rsslink = rss_get_link($course->id, $USER->id, "forum", $forum->id, $tooltiptext);
|
||||
}
|
||||
//Depending of rsslink
|
||||
if (!empty($rsslink)) {
|
||||
//Save data
|
||||
$generaltable->data[] = array ($forumlink, "$forum->intro", "$count", $sublink,$rsslink);
|
||||
$generaltable->data[] = array ($forumlink, "$forum->intro", "$count", $sublink, $rsslink);
|
||||
} else {
|
||||
$generaltable->data[] = array ($forumlink, "$forum->intro", "$count", $sublink);
|
||||
}
|
||||
} else {
|
||||
$generaltable->data[] = array ($forumlink, "$forum->intro", "$count");
|
||||
//Depending of rsslink
|
||||
if (!empty($rsslink)) {
|
||||
$generaltable->data[] = array ($forumlink, "$forum->intro", "$count", $rsslink);
|
||||
} else {
|
||||
$generaltable->data[] = array ($forumlink, "$forum->intro", "$count");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -182,12 +197,13 @@
|
||||
$learningtable->head = array ($strforum, $strdescription, $strdiscussions);
|
||||
$learningtable->align = array ("left", "left", "center");
|
||||
|
||||
if ($can_subscribe = (isstudent($course->id) or isteacher($course->id) or isadmin() or $course->id == SITEID)) {
|
||||
if ($can_subscribe = (isstudent($course->id) or isteacher($course->id) or isadmin())) {
|
||||
$learningtable->head[] = $strsubscribed;
|
||||
$learningtable->align[] = "center";
|
||||
}
|
||||
|
||||
if ($show_rss = ($can_subscribe && isset($CFG->enablerssfeeds) && isset($CFG->forum_enablerssfeeds) &&
|
||||
if ($show_rss = (($can_subscribe || $course->id == SITEID) &&
|
||||
isset($CFG->enablerssfeeds) && isset($CFG->forum_enablerssfeeds) &&
|
||||
$CFG->enablerssfeeds && $CFG->forum_enablerssfeeds)) {
|
||||
$learningtable->head[] = $strrss;
|
||||
$learningtable->align[] = "center";
|
||||
@ -233,6 +249,26 @@
|
||||
$forumlink = "<a class=\"dimmed\" href=\"view.php?f=$forum->id\">$forum->name</a>";
|
||||
}
|
||||
|
||||
//If this forum has RSS activated, calculate it
|
||||
$rsslink = '';
|
||||
if ($show_rss) {
|
||||
if ($forum->rsstype and $forum->rssarticles) {
|
||||
//Calculate the tolltip text
|
||||
if ($forum->rsstype == 1) {
|
||||
$tooltiptext = get_string("rsssubscriberssdiscussions","forum",$forum->name);
|
||||
} else {
|
||||
$tooltiptext = get_string("rsssubscriberssposts","forum",$forum->name);
|
||||
}
|
||||
if (empty($USER->id)) {
|
||||
$userid = 0;
|
||||
} else {
|
||||
$userid = $USER->id;
|
||||
}
|
||||
//Get html code for RSS link
|
||||
$rsslink = rss_get_link($course->id, $userid, "forum", $forum->id, $tooltiptext);
|
||||
}
|
||||
}
|
||||
|
||||
if ($can_subscribe) {
|
||||
if (forum_is_forcesubscribed($forum->id)) {
|
||||
$sublink = get_string("yes");
|
||||
@ -253,26 +289,20 @@
|
||||
$sublink = "<a title=\"$subtitle\" href=\"subscribe.php?id=$forum->id\">$subscribed</a>";
|
||||
}
|
||||
}
|
||||
//If this forum has RSS activated, calculate it
|
||||
if ($show_rss) {
|
||||
$rsslink = '';
|
||||
if ($forum->rsstype and $forum->rssarticles) {
|
||||
//Calculate the tolltip text
|
||||
if ($forum->rsstype == 1) {
|
||||
$tooltiptext = get_string("rsssubscriberssdiscussions","forum",$forum->name);
|
||||
} else {
|
||||
$tooltiptext = get_string("rsssubscriberssposts","forum",$forum->name);
|
||||
}
|
||||
//Get html code for RSS link
|
||||
$rsslink = rss_get_link($course->id, $USER->id, "forum", $forum->id, $tooltiptext);
|
||||
}
|
||||
//Depending of rsslink
|
||||
if (!empty($rsslink)) {
|
||||
//Save data
|
||||
$learningtable->data[] = array ($printsection,$forumlink, "$forum->intro", "$count", $sublink,$rsslink);
|
||||
$learningtable->data[] = array ($printsection,$forumlink, "$forum->intro", "$count", $sublink, $rsslink);
|
||||
} else {
|
||||
$learningtable->data[] = array ($printsection,$forumlink, "$forum->intro", "$count", $sublink);
|
||||
}
|
||||
} else {
|
||||
$learningtable->data[] = array ($printsection, $forumlink, "$forum->intro", "$count");
|
||||
//Depending of rsslink
|
||||
if (!empty($rsslink)) {
|
||||
$learningtable->data[] = array ($printsection, $forumlink, "$forum->intro", "$count", $rsslink);
|
||||
} else {
|
||||
$learningtable->data[] = array ($printsection, $forumlink, "$forum->intro", "$count");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@
|
||||
}
|
||||
|
||||
|
||||
if ($USER) {
|
||||
if (!empty($USER->id)) {
|
||||
echo '<td align="right">';
|
||||
$SESSION->fromdiscussion = "$FULLME";
|
||||
if (forum_is_forcesubscribed($forum->id)) {
|
||||
@ -158,18 +158,24 @@
|
||||
echo "<font size=\"1\"><a title=\"$subtexttitle\" href=\"subscribe.php?id=$forum->id\">$subtext</a></font>";
|
||||
}
|
||||
|
||||
//If rss are activated at site and forum level and this forum has rss defined, show link
|
||||
if (isset($CFG->enablerssfeeds) && isset($CFG->forum_enablerssfeeds) &&
|
||||
$CFG->enablerssfeeds && $CFG->forum_enablerssfeeds && $forum->rsstype and $forum->rssarticles) {
|
||||
echo "<br />";
|
||||
if ($forum->rsstype == 1) {
|
||||
$tooltiptext = get_string("rsssubscriberssdiscussions","forum",$forum->name);
|
||||
} else {
|
||||
$tooltiptext = get_string("rsssubscriberssposts","forum",$forum->name);
|
||||
}
|
||||
rss_print_link($course->id, $USER->id, "forum", $forum->id, $tooltiptext);
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
//If rss are activated at site and forum level and this forum has rss defined, show link
|
||||
if (isset($CFG->enablerssfeeds) && isset($CFG->forum_enablerssfeeds) &&
|
||||
$CFG->enablerssfeeds && $CFG->forum_enablerssfeeds && $forum->rsstype and $forum->rssarticles) {
|
||||
echo '</tr><tr><td align="right">';
|
||||
if ($forum->rsstype == 1) {
|
||||
$tooltiptext = get_string("rsssubscriberssdiscussions","forum",$forum->name);
|
||||
} else {
|
||||
$tooltiptext = get_string("rsssubscriberssposts","forum",$forum->name);
|
||||
}
|
||||
if (empty($USER->id)) {
|
||||
$userid = 0;
|
||||
} else {
|
||||
$userid = $USER->id;
|
||||
}
|
||||
rss_print_link($course->id, $userid, "forum", $forum->id, $tooltiptext);
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
|
@ -55,9 +55,10 @@
|
||||
$table->align = array ("LEFT", "CENTER");
|
||||
}
|
||||
|
||||
$can_subscribe = (isstudent($course->id) or isteacher($course->id) or isadmin() or $course->id == SITEID);
|
||||
$can_subscribe = (isstudent($course->id) or isteacher($course->id) or isadmin());
|
||||
|
||||
if ($show_rss = ($can_subscribe && isset($CFG->enablerssfeeds) && isset($CFG->glossary_enablerssfeeds) &&
|
||||
if ($show_rss = (($can_subscribe || $course->id == SITEID) &&
|
||||
isset($CFG->enablerssfeeds) && isset($CFG->glossary_enablerssfeeds) &&
|
||||
$CFG->enablerssfeeds && $CFG->glossary_enablerssfeeds)) {
|
||||
$table->head[] = $strrss;
|
||||
$table->align[] = "CENTER";
|
||||
@ -92,8 +93,13 @@
|
||||
if ($glossary->rsstype and $glossary->rssarticles) {
|
||||
//Calculate the tolltip text
|
||||
$tooltiptext = get_string("rsssubscriberss","glossary",$glossary->name);
|
||||
if (empty($USER->id)) {
|
||||
$userid = 0;
|
||||
} else {
|
||||
$userid = $USER->id;
|
||||
}
|
||||
//Get html code for RSS link
|
||||
$rsslink = rss_get_link($course->id, $USER->id, "glossary", $glossary->id, $tooltiptext);
|
||||
$rsslink = rss_get_link($course->id, $userid, "glossary", $glossary->id, $tooltiptext);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,12 @@
|
||||
$CFG->enablerssfeeds && $CFG->glossary_enablerssfeeds && $glossary->rsstype && $glossary->rssarticles) {
|
||||
echo '<table width="100%" border="0" cellpadding="3" cellspacing="0"><tr valign="top"><td align="right">';
|
||||
$tooltiptext = get_string("rsssubscriberss","glossary",$glossary->name);
|
||||
rss_print_link($course->id, $USER->id, "glossary", $glossary->id, $tooltiptext);
|
||||
if (empty($USER->id)) {
|
||||
$userid = 0;
|
||||
} else {
|
||||
$userid = $USER->id;
|
||||
}
|
||||
rss_print_link($course->id, $userid, "glossary", $glossary->id, $tooltiptext);
|
||||
echo '</td></tr></table>';
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user