vbTimelines LITE for VB 3.0 gold
(Not Counting the required hack by kentaurus)
New Files: 1
Files to Edit: 1
Templates to Add: 4
Requirements and Credits-
Go add the
attachments in calendar events by kentaurus hack now. it is worth it.
and required. and worth it. Remember to click install.
Attachments in calendar events
A variation of the recent attachments hack by Mindtrix was used in this hack so please click install over there
and use the standard version as well to display recent attachments to the posts
in your forum. Don't forget to click install there too.
Recent Attachments
Features
The following are the features that are presently avalible in vBTimelines LITE,
Users create their own calendar.
Users become the calendar moderator for their calendar.
(Only they (and mods/admins of course) can add/edit/delete events from/to their calendar.)
Recently Added Images from user calendars.
most recently added updates are listed.
Users get Create Calendar or Jump to Your Calendar link based on if they have a calendar yet.
Why this makes sense.../What the hell would I do with that?
Users can write their own "diary" style entries.
They can input both past and future events.
Therefore it's not only a diary but a planner of sorts.
I am running a garden site. Users add entries into their "egarden"
where they can show pictures and write about their plants, veggies, and flowers.
Keep track of weather events, fertilization etc... So this is a record for them
and the community to view and learn from. You may have a similar or different use for
this so be creative.
The Vbulletin calendar is the most underutilized part of VB and has exciting possibilities. I could easily see this being useful in many community's. Car modders/racers can keep a timelined gallery of their projects/acheivements, Lots of communities would enjoy a diary style utility.
Installation-
Upload vbtimelines.php to your forum directory
PHP Code:
<?php
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'vbtimelines');
$phrasegroups = array(
);
$specialtemplates = array(
);
$globaltemplates = array(
'vbtimelines',
);
$actiontemplates = array(
);
require_once('./global.php');
$navbits = array();
$navbits[$parent] = 'vbTimelines Index';
$navbits = construct_navbits($navbits);
$allgardens=$DB_site->query("SELECT description, dateline, lupdatemonth, lupdateday, lupdateyear, calendarid, title FROM calendar
WHERE displayorder=999 ORDER BY dateline DESC LIMIT 20");
$temp="SELECT calendarid FROM calendar WHERE title='".$bbuserinfo['username']."'";
$value=$DB_site->query($temp);
if($gardens = $DB_site->fetch_array($value))
{
$newlink='<img src="./images/misc/menu_open.gif"><a href="calendar.php?c='.$gardens['calendarid'].'"> Jump to your vbTimeline</a>';
}
else
{
$newlink='<img src="./images/misc/menu_open.gif"><a href="calendar.php?add=true"> Create your new vbTimeline</a>';
}
// Start recent attachments CODE BY MINDTRIX modified by GEO
$trix = $DB_site->query("SELECT calendar, counter, attachmentid,
dateline, filename FROM attachment WHERE
calendar>0 AND dateline < " . TIME() ." ORDER BY dateline DESC LIMIT 4");
while ($recentattachment = $DB_site->fetch_array($trix))
{
eval('$latestattachments .= "' . fetch_template('recent_attachments2') . '";');
}
//End recent attachments
while($gardens = $DB_site->fetch_array($allgardens))
{
$recentattachment = $DB_site->fetch_array($trix);
eval('$vbtimelinesbits .= "' . fetch_template('vbtimelinesbits') . '";');
}
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('vbtimelines').$stringy. '");');
?>
Create 4 new fields in the calendar table of your DB
lupdatemonth as char(2)
lupdateyear as VARCHAR(4)
lupdateday as char(2)
dateline as INT(10)
Edit In calendar.php-
Find:
PHP Code:
$idname = $vbphrase['event'];
Add after:
PHP Code:
if ($_REQUEST['add'] == 'true')
{
if($bbuserinfo['username']!="Unregistered")
{
}
else
{
print_no_permission();
}
// ### NAVBAR #################################################
$navbits = array();
$ltr='Add New Calendar';
$navtext = $ltr;
$navurl = "add?=true";
if ($navtext && $navurl) {
$navbits = array("calendar.php" => 'Calendar',
"calendar.php?$navurl" => $navtext);
}
$navbits = construct_navbits($navbits);
eval('$navbar = "'.fetch_template('navbar').'";');
eval('print_output("' . fetch_template('calendar_add') . '");');
}
if ($_POST['do'] == 'doaddcalendar')
{
globalize($_POST, array(
'title' => STR,
'description' => STR,
'year' => STR)
);
$name=$bbuserinfo['username'];
$today = getdate(TIMENOW - $vboptions['hourdiff']);
$dateliner = gmmktime(0, 0, 0, $today['mon'], $today['day'], $today['year']);
$q1="INSERT INTO calendar (`title`, `description`, `displayorder`,
`neweventemail`, `moderatenew`, `startofweek`, `options`,
`cutoff`, `eventcount`, `startyear`, `endyear`,
`holidays`, `lupdatemonth`, `lupdateyear`, `lupdateday`, `dateline`)
VALUES ('".$name."', '".$description."', 2, 0, 1, 116, 40,
4, 4, 1970, 2037, 0, ".$today['mon'].", ".$today['year'].", ".$today['mday'].",".$dateliner.")";
$DB_site->query($q1);
$num=$DB_site->query_first("SELECT calendarid AS cid FROM calendar
WHERE title='$name' AND description='$description'");
$temp="INSERT INTO `calendarmoderator`
(`userid`, `calendarid`, `neweventemail`, `permissions`)
VALUES ('".$bbuserinfo['userid']."', ".$num['cid'].", '".$bbuserinfo['email']."', 7);";
$DB_site->query($temp);
$temp1=$num['cid'];
$DB_site->query("INSERT INTO `calendarpermission`
(`calendarid`, `usergroupid`, `calendarpermissions`)
VALUES ($temp1, 2, 17)");
$DB_site->query("INSERT INTO `calendarpermission`
(`calendarid`, `usergroupid`, `calendarpermissions`)
VALUES ($temp1, 1, 17)");
$DB_site->query("INSERT INTO `calendarpermission`
(`calendarid`, `usergroupid`, `calendarpermissions`)
VALUES ($temp1, 3, 17)");
// ### NAVBAR #################################################
$navbits = array();
$ltr='Added New Calendar';
$navtext = $ltr;
$navurl = "";
if ($navtext && $navurl) {
$navbits = array("calendar.php" => 'Calendar',
"calendar.php?$navurl" => $navtext);
}
$navbits = construct_navbits($navbits);
$errormessage="Your Calendar has been added.";
$url="vbtimelines.php";
eval('$navbar = "'.fetch_template('navbar').'";');
eval('print_output(" ' . fetch_template('STANDARD_REDIRECT') . '");');
}
/*END ADD ENTRY CODE*/
Find:
PHP Code:
$DB_site->query("
INSERT INTO " . TABLE_PREFIX . "event (calendarid, userid, event, recurring, recuroption,dateline_to,dateline_from, title, allowsmilies, customfields, dateline, visible, utc)
VALUES ($calendarid, $bbuserinfo[userid], '" . addslashes($message) . "', '" . addslashes($pattern) . "', '" . addslashes($patoptions) . "', '$dateline_to', '$dateline_from', '" . addslashes($title) . "', '$allowsmilies', '" . addslashes($customfields) . "', " . TIMENOW . ", $visible, '" . addslashes($timezoneoffset) . "')
");
$eventid = $DB_site->insert_id();
Add after:
PHP Code:
$today = getdate(TIMENOW - $vboptions['hourdiff']);
$name=$bbuserinfo[username];
$month=$today['mon'];
$day=$today['mday'];
$year=$today['year'];
$DB_site->query("UPDATE calendar
SET dateline = ".TIMENOW."
WHERE title = '$bbuserinfo[username]'
");
$DB_site->query("UPDATE calendar
SET lupdatemonth = $month
WHERE title = '$name'
");
$DB_site->query("UPDATE calendar
SET lupdateday = $day
WHERE title = '$name'
");
$DB_site->query("UPDATE calendar
SET lupdateyear = $year
WHERE title = '$name'
");
Create Templates
Add template calendar_add:
PHP Code:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header
$navbar
<form action="calendar.php" method="post">
<input type="hidden" name="title" value="$bbuserinfo[username]">
<input type="hidden" name="do" value="doaddcalendar">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr align="center">
<td class="tcat" align="center" colspan="2">
<span class="smallfont"><b>Add New Calendar</b></span>
</td>
</tr>
<tr valign="top">
<td align=center>
<textarea name="description" rows="4" cols="60" class="bginput"></textarea>
</td>
</tr>
<tr valign="top">
<td align=center>
<input type="submit" class="button" value="$vbphrase[save_changes]" accesskey="s" />
<input type="reset" class="button" value="$vbphrase[reset_fields]" accesskey="r" />
</td>
</tr>
</form>
$footer
</body>
</html>
Add template vbtimelinesbits:
PHP Code:
<tr>
<td class=alt2>
<a href="calendar.php?c=$gardens[calendarid]&month=$gardens[lupdatemonth]&year=$gardens[lupdateyear]">$gardens[title]</a></td>
<td width="60%" class=alt1 align=left>
$gardens[description]
</td>
<td class=alt2 align=right>Latest Update: <a href="calendar.php?c=$gardens[calendarid]&month=$gardens[lupdatemonth]&year=$gardens[lupdateyear]">$gardens[lupdatemonth]/$gardens[lupdateday]/$gardens[lupdateyear]</a>
</tr>
Add template vbtimelines:
PHP Code:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header
$navbar
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">
<tr>
<td class="tcat">Recent Calendar Images:</td>
</tr>
<tr><td class="tcat" align=center>
$latestattachments
</td></tr></table>
<table align="center" width="100%">
<tr>
<td align ="center" width="100%">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat">Latest Calendar Updates:</td>
<td class="tcat"></td>
<td class="tcat" align="right">$newlink</td>
</tr>
$vbtimelinesbits
</table>
</td>
</tr>
</table>
$footer
</body>
</html>
Add template recent_attachments2: (ORIGINAL CODE BY MINDTRIX - Modified by Geo)
PHP Code:
<a href="calendar.php?do=getinfo&e=$recentattachment[calendar]" target="_blank">
<img src="attachment.php?attachmentid=$recentattachment[attachmentid]&thumb=1" alt="$recentattachment[filename]" width="150" border="0"></a> <img src="./spacer.gif" height="0" width="10" border="0">
This hack is released as is, with a promise of zero support.
Not to say you'll get no reply but I have no time for support,
I'm getting married etc... so I'm too busy.
Please reply if this installation text has errors.
Screenshots
Here is the basic vbtimelines interface.
4 recent images from your users calendars, followed by a listing of 20 or so calendars with the latest updates.
Clicking an image of the recent attachments will bring you to the corresponding calendar event.