Skip to content

Commit

Permalink
First version of RSS System.
Browse files Browse the repository at this point in the history
Discussion and post forum feeds supported.
Integrated in cron system.
Some strings missing.
Test, test, test...
  • Loading branch information
stronk7 committed May 2, 2004
1 parent 750024e commit 8adcb49
Show file tree
Hide file tree
Showing 18 changed files with 685 additions and 2 deletions.
16 changes: 16 additions & 0 deletions admin/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,22 @@
</td>
</tr>

<tr valign=top>
<td align=right><p>enablerssfeeds:</td>
<td>
<?php
unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");

choose_from_menu ($options, "enablerssfeeds", $config->enablerssfeeds, "", "", "");
?>
</td>
<td>
<?php print_string("configenablerssfeeds") ?>
</td>
</tr>

<tr>
<td colspan=3 align=center>
<input type="submit" value="<?php print_string("savechanges") ?>"></td>
Expand Down
14 changes: 14 additions & 0 deletions admin/cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,20 @@
}
}

if (!empty($CFG->enablerssfeeds)) { //Defined in admin/variables page
if (file_exists("$CFG->dirroot/rss/rsslib.php")) {
include_once("$CFG->dirroot/rss/rsslib.php");
echo "Running rssfeeds if required...\n";
flush();

if ( ! cron_rss_feeds()) {
echo "Something went wrong while generating rssfeeds!!!\n";
} else {
echo "Rssfeeds finished\n";
}
}
}

echo "Cron script completed correctly\n";

$difftime = microtime_diff($starttime, microtime());
Expand Down
2 changes: 2 additions & 0 deletions lang/en/forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@
$string['repliesone'] = '$a reply so far';
$string['reply'] = 'Reply';
$string['replyforum'] = 'Reply to forum';
$string['rsssubscriberssdiscussions'] = 'This is a link to susbscribe to the \'$a\' forum RSS discussions channel';
$string['rsssubscriberssposts'] = 'This is a link to subscribe to the \'$a\' forum RSS posts channel';
$string['search'] = 'Search';
$string['searchforums'] = 'Search forums';
$string['searcholderposts'] = 'Search older posts...';
Expand Down
24 changes: 24 additions & 0 deletions mod/forum/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,30 @@
<?php print_string("configmaxbytes", "forum") ?>
</td>
</tr>
<tr valign=top>
<td align=right><p>forum_enablerssfeeds:</td>
<td>
<?php
if ($CFG->enablerssfeeds == 0) {
print_string("no");
} else {
unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");

choose_from_menu ($options, "forum_enablerssfeeds", $CFG->forum_enablerssfeeds, "", "", "");
}
?>
</td>
<td>
<?php
print_string("configenablerssfeeds","forum");
if ($CFG->enablerssfeeds == 0) {
print_string("configenablerssfeedsdisabled","forum");
}
?>
</td>
</tr>

<tr>
<td colspan=3 align=center>
Expand Down
6 changes: 6 additions & 0 deletions mod/forum/db/mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ function forum_upgrade($oldversion) {
if ($oldversion < 2004020600) {
table_column("forum_discussions", "", "usermodified", "integer", "10", "unsigned", "0", "", "timemodified");
}

if ($oldversion < 2004050300) {
table_column("forum","","rsstype","tinyint","2", "unsigned", "0", "", "forcesubscribe");
table_column("forum","","rssarticles","tinyint","2", "unsigned", "0", "", "rsstype");
set_config("forum_enablerssfeeds",0);
}

return true;

Expand Down
2 changes: 2 additions & 0 deletions mod/forum/db/mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ CREATE TABLE prefix_forum (
scale int(10) NOT NULL default '0',
maxbytes int(10) unsigned NOT NULL default '0',
forcesubscribe tinyint(1) unsigned NOT NULL default '0',
rsstype tinyint(2) unsigned NOT NULL default '0',
rssarticles tinyint(2) unsigned NOT NULL default '0',
timemodified int(10) unsigned NOT NULL default '0',
PRIMARY KEY (id),
UNIQUE KEY id (id)
Expand Down
2 changes: 2 additions & 0 deletions mod/forum/db/oci8po.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ CREATE TABLE prefix_forum (
scale number(10) default '0' NOT NULL,
maxbytes number(10) default '0' NOT NULL,
forcesubscribe number(1) default '0' NOT NULL,
rsstype number(2) default '0' NOT NULL,
rssarticles number(2) default '0' NOT NULL,
timemodified number(10) default '0' NOT NULL
);

Expand Down
6 changes: 6 additions & 0 deletions mod/forum/db/postgres7.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ function forum_upgrade($oldversion) {
table_column("forum_discussions", "", "usermodified", "integer", "10", "unsigned", "0", "", "timemodified");
}

if ($oldversion < 2004050300) {
table_column("forum","","rsstype","integer","2", "unsigned", "0", "", "forcesubscribe");
table_column("forum","","rssarticles","integer","2", "unsigned", "0", "", "rsstype");
set_config("forum_enablerssfeeds",0);
}

return true;

}
Expand Down
2 changes: 2 additions & 0 deletions mod/forum/db/postgres7.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ CREATE TABLE prefix_forum (
scale integer NOT NULL default '0',
maxbytes integer NOT NULL default '0',
forcesubscribe integer NOT NULL default '0',
rsstype integer NOT NULL default '0',
rssarticles integer NOT NULL default '0',
timemodified integer NOT NULL default '0'
);
# --------------------------------------------------------
Expand Down
43 changes: 43 additions & 0 deletions mod/forum/mod.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
if (!isset($form->maxbytes)) {
$form->maxbytes = $CFG->forum_maxbytes;
}
if (!isset($form->rsstype)) {
$form->rsstype = 0;
}
if (!isset($form->rssarticles)) {
$form->rssarticles = 0;
}
?>
<form name="form" method="post" <?php echo $onsubmit ?> action="mod.php">
<table cellpadding=5>
Expand Down Expand Up @@ -109,7 +115,44 @@
?>
</td>
</tr>
<?php
//Only show rss parameters if rss is activated at site and forum levels
if ($CFG->enablerssfeeds && $CFG->forum_enablerssfeeds) {
echo "<tr valign=top>";
echo "<td align=right><p><b>".get_string("rsstype", "forum")."</b></p></td>";
echo "<td>";
unset($choices);
$choices[0] = get_string("none");
$choices[1] = get_string("discussions", "forum");
$choices[2] = get_string("posts", "forum");
choose_from_menu ($choices, "rsstype", $form->rsstype, "");
helpbutton("rsstype", get_string("rsstype", "forum"), "forum");
echo "</td>";
echo "</tr>";

echo "<tr valign=top>";
echo "<td align=right><p><b>".get_string("rssarticles", "forum")."</b></p></td>";
echo "<td>";
unset($choices);
$choices[0] = "0";
$choices[1] = "1";
$choices[2] = "2";
$choices[3] = "3";
$choices[4] = "4";
$choices[5] = "5";
$choices[10] = "10";
$choices[15] = "15";
$choices[20] = "20";
$choices[25] = "25";
$choices[30] = "30";
$choices[40] = "40";
$choices[50] = "50";
choose_from_menu ($choices, "rssarticles", $form->rssarticles, "");
helpbutton("rssarticles", get_string("rssarticles", "forum"), "forum");
echo "</td>";
echo "</tr>";
}
?>
<tr>
<td align=right valign=top><p><b><?php print_string("allowratings", "forum") ?>:</b></p></td>
<td>
Expand Down
Loading

0 comments on commit 8adcb49

Please sign in to comment.