changeset 123:5837b9333964

Add new "about" page, and setting for default page.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 22 Oct 2013 15:18:09 +0300
parents 7d9e8c82e744
children 986c25c2e2bc
files about.inc.php admajax.php createdb.php index.php mconfig.inc.php.example news.inc.php usrajax.php usrlogin.php
diffstat 8 files changed, 31 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/about.inc.php	Tue Oct 22 15:18:09 2013 +0300
@@ -0,0 +1,12 @@
+<?
+echo stGetSetting("aboutDescription");
+
+if (stGetSetting("showNewsOnAbout") &&
+  ($res = stExecSQL("SELECT * FROM news ORDER BY utime DESC LIMIT 1")) !== FALSE)
+{
+  foreach ($res as $item)
+    stPrintNewsItem($item);
+
+  echo "<a class=\"moreNews\" href=\"news\">More news ...</a>\n";
+}
+?>
--- a/admajax.php	Tue Oct 22 14:40:42 2013 +0300
+++ b/admajax.php	Tue Oct 22 15:18:09 2013 +0300
@@ -14,7 +14,7 @@
 
   stSessionEnd(SESS_ADMIN);
 
-  header("Location: news");
+  header("Location: ".stGetSetting("defaultPage"));
   exit;
 }
 
--- a/createdb.php	Tue Oct 22 14:40:42 2013 +0300
+++ b/createdb.php	Tue Oct 22 15:18:09 2013 +0300
@@ -30,6 +30,9 @@
 
   "requireEMail"     => array(VT_BOOL, false, "Require e-mail address in registrations"),
 
+  "showNews"         => array(VT_BOOL, true, "Enable News link on main menu"),
+  "showNewsOnAbout"  => array(VT_BOOL, true, "Show latest news item on About page"),
+
   "registerInfoText" => array(VT_TEXT, "<p>
 Only your <b>handle</b> and the answer to the botcheck are strictly required.
 If you plan on joining the IRC channel
@@ -108,7 +111,10 @@
 </div>", "Site header text"),
 
 
-  "newsDescription"  => array(VT_TEXT, "
+  "newsHeader"  => array(VT_TEXT, "", "News page header text"),
+
+
+  "aboutDescription"  => array(VT_TEXT, "
 <div style=\"text-align: center;\">
 <img src=\"img/fap.png\" alt=\"FAP\" />
 <p>
@@ -119,7 +125,7 @@
 </span>
 </p>
 </div>",
-  "News page header text"),
+  "About page text"),
 
 
   "entrySubmitInfo" => array(VT_TEXT, "Rules for entry submission ... ", "Entry submission information blurb"),
--- a/index.php	Tue Oct 22 14:40:42 2013 +0300
+++ b/index.php	Tue Oct 22 15:18:09 2013 +0300
@@ -42,7 +42,11 @@
 <div id="menu">
   <? echo stGetSetting("siteMenuHeader") ?>
 
-  <a href="news">News</a>
+  <a href="about">About</a>
+<?
+if (stGetSetting("showNews"))
+  echo "<a href=\"news\">News</a>\n";
+?>
   <a href="compos">Compos</a>
   <a href="event">Event</a>
 <?
--- a/mconfig.inc.php.example	Tue Oct 22 14:40:42 2013 +0300
+++ b/mconfig.inc.php.example	Tue Oct 22 15:18:09 2013 +0300
@@ -8,6 +8,8 @@
 
   "debug"           => false,
 
+  "defaultPage"     => "about", // Default page
+
   "userKeyLength"   => 8,
   "voteMin"         => -1,
   "voteMax"         => 2,
--- a/news.inc.php	Tue Oct 22 14:40:42 2013 +0300
+++ b/news.inc.php	Tue Oct 22 15:18:09 2013 +0300
@@ -1,5 +1,5 @@
 <?
-echo stGetSetting("newsDescription");
+echo stGetSetting("newsHeader");
 
 if (($res = stExecSQL("SELECT * FROM news ORDER BY utime DESC")) !== FALSE)
 {
--- a/usrajax.php	Tue Oct 22 14:40:42 2013 +0300
+++ b/usrajax.php	Tue Oct 22 15:18:09 2013 +0300
@@ -44,7 +44,7 @@
 
   stSessionEnd(SESS_USER);
 
-  header("Location: news");
+  header("Location: ".stGetSetting("defaultPage"));
   exit;
 }
 
--- a/usrlogin.php	Tue Oct 22 14:40:42 2013 +0300
+++ b/usrlogin.php	Tue Oct 22 15:18:09 2013 +0300
@@ -34,5 +34,5 @@
   $gotoPage = "loginerror";
 }
 
-header("Location: ".($gotoPage !== FALSE ? $gotoPage : "news"));
+header("Location: ".($gotoPage !== FALSE ? $gotoPage : stGetSetting("defaultPage")));
 ?>
\ No newline at end of file