1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-30 17:50:12 +02:00

new module creation

This commit is contained in:
mcfly
2006-12-02 04:36:16 +00:00
commit e149b35fcc
2196 changed files with 182987 additions and 0 deletions

View File

@@ -0,0 +1,134 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/blogcalendar_menu/archive.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:34:44 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
| Based on code by: Thomas Bouve (crahan@gmx.net)
*/
require_once("../../class2.php");
require_once(e_HANDLER."userclass_class.php");
$lan_file = e_PLUGIN."blogcalendar_menu/languages/".e_LANGUAGE.".php";
if (file_exists($lan_file)) {
require_once($lan_file);
} else {
require_once(e_PLUGIN."blogcalendar_menu/languages/English.php");
};
require_once("calendar.php");
require_once("functions.php");
require_once(HEADERF);
// ---------------------
// initialize some cruft
// ---------------------
$sql = new db;
$prefix = e_PLUGIN."blogcalendar_menu";
$marray = array(BLOGCAL_M1, BLOGCAL_M2, BLOGCAL_M3, BLOGCAL_M4,
BLOGCAL_M5, BLOGCAL_M6, BLOGCAL_M7, BLOGCAL_M8,
BLOGCAL_M9, BLOGCAL_M10, BLOGCAL_M11, BLOGCAL_M12);
// if nr of rows per month is not set, default to 3
$months_per_row = $pref['blogcal_mpr']?$pref['blogcal_mpr']:
"3";
$pref['blogcal_ws'] = "monday";
// -------------------------------------
// what year are we supposed to display?
// -------------------------------------
$cur_year = date("Y");
$cur_month = date("n");
$cur_day = date("j");
if (strstr(e_QUERY, "year")) {
$tmp = explode(".", e_QUERY);
$req_year = $tmp[1];
} else {
$req_year = $cur_year;
}
// --------------------------------
// look for the first and last year
// --------------------------------
$sql->db_Select_gen("SELECT news_id, news_datestamp from ".MPREFIX."news ORDER BY news_datestamp LIMIT 0,1");
$first_post = $sql->db_Fetch();
$start_year = date("Y", $first_post['news_datestamp']);
$end_year = $cur_year;
// ----------------------
// build the yearselector
// ----------------------
$year_selector = "<div class='forumheader' style='text-align: center; margin-bottom: 2px;'>";
$year_selector .= "".BLOGCAL_ARCHIV1.": <select name='activate' onChange='urljump(this.options[selectedIndex].value)' class='tbox'>";
for($i = $start_year; $i <= $end_year; $i++) {
$start = mktime(0, 0, 0, 1, 1, intval($req_year));
$end = mktime(23, 59, 59, 12, 31, intval($req_year));
// create the option entry
$year_link = $prefix."/archive.php?year.".$i;
$year_selector .= "<option value='".$year_link."'";
if ($i == $req_year) {
$year_selector .= " selected";
}
if ($sql->db_Select("news", "news_id, news_datestamp, news_class", "news_datestamp > $start AND news_datestamp < $end")) {
while ($news = $sql->db_Fetch()) {
if (check_class($news['news_class'])) {
list($xmonth, $xday) = explode(" ", date("n j", $news['news_datestamp']));
if (!$day_links[$xmonth][$xday]) {
$day_links[$xmonth][$xday] = e_BASE."news.php?day.".formatdate($req_year, $xmonth, $xday);
}
}
}
}
$year_selector .= ">".$i."</option>";
}
$year_selector .= "</select>";
// --------------------------
// create the archive display
// --------------------------
$newline = 0;
$archive = "<div style='text-align:center'><table border='0' cellspacing='7'><tr>";
$archive .= "<td colspan='$months_per_row'><div>$year_selector</div></td></tr><tr>";
for($i = 1; $i <= 12; $i++) {
if (++$newline == $months_per_row+1) {
$archive .= "</tr><tr>";
$newline = 1;
}
$archive .= "<td style='vertical-align:top'>";
$archive .= "<div class='fcaption' style='text-align:center; margin-bottom:2px;'>";
// href the current month regardless of newsposts or any month with news
if (($req_year == $cur_year && $i == $cur_month) || $day_links[$i]) {
$archive .= "<a class='forumlink' href='".e_BASE."news.php?month.".formatDate($req_year, $i)."'>".$marray[$i-1]."</a>";
} else {
$archive .= $marray[$i-1];
}
$archive .= "</div>";
if (($req_year == $cur_year) && ($i == $cur_month)) {
$req_day = $cur_day;
} else {
$req_day = "";
}
$archive .= "<div>".calendar($req_day, $i, $req_year, $day_links[$i], $pref['blogcal_ws'])."</div></td>\n";
}
$archive .= "</tr></table></div>";
$ns->tablerender(BLOGCAL_L2 ."&nbsp;$req_year", $archive);
require_once(FOOTERF);
?>

View File

@@ -0,0 +1,131 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/blogcalendar_menu/blogcalendar_menu.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:34:44 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
| Based on code by: Thomas Bouve (crahan@gmx.net)
*/
if (!defined('e107_INIT')) { exit; }
require_once(e_PLUGIN."blogcalendar_menu/calendar.php");
require_once(e_PLUGIN."blogcalendar_menu/functions.php");
// ------------------------------
// initialization + fetch options
// ------------------------------
$prefix = e_PLUGIN."blogcalendar_menu";
$marray = array(BLOGCAL_M1, BLOGCAL_M2, BLOGCAL_M3, BLOGCAL_M4,
BLOGCAL_M5, BLOGCAL_M6, BLOGCAL_M7, BLOGCAL_M8,
BLOGCAL_M9, BLOGCAL_M10, BLOGCAL_M11, BLOGCAL_M12);
$pref['blogcal_ws'] = "monday";
// ----------------------------------------------
// get the requested and current date information
// ----------------------------------------------
list($cur_year, $cur_month, $cur_day) = explode(" ", date("Y n j"));
if (strstr(e_QUERY, "day")) {
$tmp = explode(".", e_QUERY);
$item = $tmp[1];
$req_year = substr($item, 0, 4);
$req_month = substr($item, 4, 2);
// decide on the behaviour here, do we highlight
// the day being viewed? or only 'today'?
//$req_day = substr($item, 6, 2);
// if the requested year and month are the current, then add
// the current day to the mix so the calendar highlights it
if (($req_year == $cur_year) && ($req_month == $cur_month)) {
$req_day = $cur_day;
} else {
$req_day = "";
}
}
else if(strstr(e_QUERY, "month")) {
$tmp = explode(".", e_QUERY);
$item = $tmp[1];
$req_year = substr($item, 0, 4);
$req_month = substr($item, 4, 2);
// if the requested year and month are the current, then add
// the current day to the mix so the calendar highlights it
if (($req_year == $cur_year) && ($req_month == $cur_month)) {
$req_day = $cur_day;
} else {
$req_day = "";
}
} else {
$req_year = $cur_year;
$req_month = $cur_month;
$req_day = $cur_day;
}
// -------------------------------
// create the month selection item
// -------------------------------
$month_selector = "<div class='forumheader' style='text-align: center; margin-bottom: 2px;'>";
$month_selector .= "<select name='activate' onchange='urljump(this.options[selectedIndex].value)' class='tbox'>";
// get all newsposts since the beginning of the year till now
// -------------------------------------------
// get links to all newsitems in current month
// -------------------------------------------
$month_start = mktime(0, 0, 0, $req_month, 1, $req_year);
$lastday = date("t", $month_start);
$month_end = mktime(23, 59, 59, $req_month, $lastday, $req_year);
$start = mktime(0, 0, 0, 1, 1, $req_year);
$end = time();
$sql->db_Select("news", "news_id, news_datestamp", "news_class IN (".USERCLASS_LIST.") AND news_datestamp > ".intval($start)." AND news_datestamp < ".intval($end));
while ($news = $sql->db_Fetch())
{
$xmonth = date("n", $news['news_datestamp']);
if (!isset($month_links[$xmonth]) || !$month_links[$xmonth])
{
$month_links[$xmonth] = e_BASE."news.php?month.".formatDate($req_year, $xmonth);
}
if($news['news_datestamp'] >= $month_start AND $news['news_datestamp'] <= $month_end)
{
$xday = date("j", $news['news_datestamp']);
if (!isset($day_links[$xday]) || !$day_links[$xday])
{
$day_links[$xday] = e_BASE."news.php?day.".formatDate($req_year, $req_month, $xday);
}
}
}
// if we're listing the current year, add the current month to the list regardless of posts
if ($req_year == $cur_year) {
$month_links[$cur_month] = e_BASE."news.php?month.".formatDate($cur_year, $cur_month);
}
// go over the link array and create the option fields
foreach($month_links as $index => $val) {
$month_selector .= "<option value='".$val."'";
$month_selector .= ($index == $req_month)?" selected='selected'":
"";
$month_selector .= ">".$marray[$index-1]."</option>";
}
// close the select item
$month_selector .= "</select></div>";
// ------------------------
// create and show calendar
// ------------------------
$menu = "<div style='text-align: center;'><table border='0' cellspacing='7'>";
$menu .= "<tr><td>$month_selector";
$menu .= "<div style='text-align:center'>".calendar($req_day, $req_month, $req_year, $day_links, $pref['blogcal_ws'])."</div>";
$menu .= "<div class='forumheader' style='text-align: center; margin-top:2px;'><span class='smalltext'><a href='$prefix/archive.php'>".BLOGCAL_L2."</a></span></div></td></tr>";
$menu .= "</table></div>";
$ns->tablerender(BLOGCAL_L1." ".$req_year, $menu, 'blog_calender');
?>

View File

@@ -0,0 +1,102 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/blogcalendar_menu/calendar.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:34:45 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
| Based on code by: Thomas Bouve (crahan@gmx.net) and
| and Based on: PHP Calendar by Keith Devens http://www.keithdevens.com/software/php_calendar/
*/
if (!defined('e107_INIT')) { exit; }
function calendar($req_day, $req_month, $req_year, $links = NULL, $ws = "sunday") {
// get access to the preferences
global $pref;
// prepare the day array
$darray = array(BLOGCAL_D1, BLOGCAL_D2, BLOGCAL_D3, BLOGCAL_D4,
BLOGCAL_D5, BLOGCAL_D6, BLOGCAL_D7);
// what day does the week start on?
switch($ws) {
case "monday":
$ws = "1";
break;
case "sunday":
array_unshift($darray, array_pop($darray));
$ws = "0";
}
// what's the padding we should use for the cells?
$padding = (isset($pref['blogcal_padding']) && $pref['blogcal_padding']) ? $pref['blogcal_padding']: "2";
$date = mktime(0, 0, 0, $req_month, 1, $req_year);
$last_day = date('t', $date);
$date_info = getdate($date);
$day_of_week = $date_info['wday'];
if ($ws && $day_of_week == 0) $day_of_week = 7;
// print the daynames
$calendar = "<table class='fborder'>";
$calendar .= '<tr>';
foreach($darray as $dheader) {
$calendar .= "<td class='forumheader' style='padding: ".$padding."px;'><span class='smalltext'>$dheader</span></td>";
}
$calendar .= "</tr>";
$calendar .= '<tr>';
$day_of_month = 1;
$tablerow = 1;
// take care of the first "empty" days of the month
if ($day_of_week-$ws > 0) {
$calendar .= "<td colspan='";
$calendar .= $day_of_week-$ws;
$calendar .= "'>&nbsp;</td>";
}
// print the days of the month (take the $ws into account)
while ($day_of_month <= $last_day) {
if ($day_of_week-$ws == 7) {
#start a new week
$calendar .= "</tr><tr>";
$day_of_week = 0+$ws;
$tablerow++;
}
if ($day_of_month == $req_day) {
$day_style = isset($links[$day_of_month]) ? "indent" : "forumheader3";
} else {
$day_style = isset($links[$day_of_month]) ? "indent" : "forumheader3";
}
$calendar .= "<td class='$day_style' style='padding: ".$padding."px;'><span class='smalltext'>";
$calendar .= isset($links[$day_of_month]) ? "<a href='".$links[$day_of_month]."'>":"";
$calendar .= $day_of_month;
$calendar .= isset($links[$day_of_month]) ? "</a>" : "";
$calendar .= "</span></td>";
$day_of_month++;
$day_of_week++;
}
if ($day_of_week-$ws != 7) {
$calendar .= '<td colspan="' . (7 - $day_of_week+$ws) . '">&nbsp;</td>';
}
$calendar .= "</tr>";
if ($tablerow != 6) {
$calendar .= "<tr><td style='padding: ".$padding."px;' colspan='6'>&nbsp;</td></tr>";
}
$calendar .= "</table>";
return $calendar;
}
?>

View File

@@ -0,0 +1,91 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/blogcalendar_menu/config.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:34:45 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
$eplug_admin = TRUE;
require_once("../../class2.php");
require_once(e_HANDLER."userclass_class.php");
$lan_file = e_PLUGIN."blogcalendar_menu/languages/".e_LANGUAGE.".php";
if (file_exists($lan_file)) {
require_once($lan_file);
} else {
require_once(e_PLUGIN."blogcalendar_menu/languages/English.php");
}
if (!getperms("1")) {
header("location:".e_BASE."index.php");
exit ;
}
require_once(e_ADMIN."auth.php");
if (isset($_POST['update_menu'])) {
while (list($key, $value) = each($_POST)) {
if ($value != BLOGCAL_CONF3) {
$pref[$key] = $value;
}
}
save_prefs();
$ns->tablerender("", "<div style='text-align:center'><b>".BLOGCAL_CONF5."</b></div>");
}
$text = "<div style='text-align:center'>
<form method='post' action='".e_SELF."?".e_QUERY."' name='menu_conf_form'>
<table style='width:85%' class='fborder' >
<tr>
<td style='width:40%' class='forumheader3'>".BLOGCAL_CONF1.": </td>
<td style='width:60%' class='forumheader3'>
<select class='tbox' name='blogcal_mpr'>";
// if the nr of months per row is undefined, default to 3
$months_per_row = $pref['blogcal_mpr']?$pref['blogcal_mpr']:
"3";
for($i = 1; $i <= 12; $i++) {
$text .= "<option value='$i'";
$text .= $months_per_row == $i?"selected":
"";
$text .= ">$i</option>";
}
$text .= "</select>
</td>
</tr>
<tr>
<td style='width:40%' class='forumheader3'>".BLOGCAL_CONF2.": </td>
<td style='width:60%' class='forumheader3'>
<input class='tbox' type='text' name='blogcal_padding' size='20' value='";
// if the cellpadding isn't defined
$padding = $pref['blogcal_padding']?$pref['blogcal_padding']:
"2";
$text .= $padding;
$text .= "' maxlength='100' />
</td>
</tr>
<tr>
<td colspan='2' class='forumheader' style='text-align:center'>
<input class='button' type='submit' name='update_menu' value='".BLOGCAL_CONF3."' />
</td>
</tr>
</table>
</form>
</div>";
$ns->tablerender(BLOGCAL_CONF4, $text);
require_once(e_ADMIN."footer.php");
?>

View File

@@ -0,0 +1,31 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/blogcalendar_menu/functions.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:34:45 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
// format a date as yyyymmdd
function formatDate($year, $month, $day = "") {
$date = $year;
$date .= (strlen($month) < 2)?"0".$month:
$month;
$date .= (strlen($day) < 2 && $day != "")?"0".$day:
$day;
return $date;
}
?>

View File

@@ -0,0 +1,49 @@
<?php
/*
+---------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
+---------------------------------------------------------------+
*/
define("BLOGCAL_L1", "News for ");
define("BLOGCAL_L2", "Archive");
define("BLOGCAL_D1", "Mo");
define("BLOGCAL_D2", "Tu");
define("BLOGCAL_D3", "We");
define("BLOGCAL_D4", "Th");
define("BLOGCAL_D5", "Fr");
define("BLOGCAL_D6", "Sa");
define("BLOGCAL_D7", "Su");
define("BLOGCAL_M1", "January");
define("BLOGCAL_M2", "February");
define("BLOGCAL_M3", "March");
define("BLOGCAL_M4", "April");
define("BLOGCAL_M5", "May");
define("BLOGCAL_M6", "June");
define("BLOGCAL_M7", "July");
define("BLOGCAL_M8", "August");
define("BLOGCAL_M9", "September");
define("BLOGCAL_M10", "October");
define("BLOGCAL_M11", "November");
define("BLOGCAL_M12", "December");
define("BLOGCAL_1", "News Items");
define("BLOGCAL_CONF1", "Months/row");
define("BLOGCAL_CONF2", "Cellpadding");
define("BLOGCAL_CONF3", "Update Menu Settings");
define("BLOGCAL_CONF4", "BlogCal Menu Configuration");
define("BLOGCAL_CONF5", "BlogCal menu configuration saved");
define("BLOGCAL_ARCHIV1", "Select Archive");
?>

View File

@@ -0,0 +1,50 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/blogcalendar_menu/styles.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:34:45 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
// -----------------------
// blogcal menu style vars
// -----------------------
$bc_menu_wrapper = "";
$menu_header = "";
$menu_body = "";
$menu_footer = "";
// --------------------------
// calendar object style vars
// --------------------------
$cal_header_cell = "";
$cal_blank_cell = "";
$cal_cell = "";
$cal_linked_cell = "";
$cal_hl_cell = "";
$cal_hl_linked_cell = "";
// --------------------------
// archive section style vars
// --------------------------
$arch_wrapper = "";
$arch_header = "";
$arch_cell = "";
$arch_cell_header = "";
$arch_cell_body = "";
?>