Skip to content

Instantly share code, notes, and snippets.

@sjungling
Created June 9, 2009 15:55
Show Gist options
  • Save sjungling/126593 to your computer and use it in GitHub Desktop.
Save sjungling/126593 to your computer and use it in GitHub Desktop.
// determine sponsor name & URL
$result = DBQuery($database, "SELECT * FROM vtcal_sponsor WHERE calendarid='".sqlescape($_SESSION["CALENDARID"])."' AND id='".sqlescape($event['sponsorid'])."'" );
$sponsor = $result->fetchRow(DB_FETCHMODE_ASSOC,0);
$id = getNewEventId();
$id1 = substr($id,0,10);
for ($i=1; $i<=$eventnr; $i++) {
$event = $eventlist[$i];
if (empty($event['displayedsponsor'])) { $event['displayedsponsor']=$sponsor['name']; }
if (empty($event['displayedsponsorurl'])) { $event['displayedsponsorurl']=$sponsor['url']; }
$id1++;
$eventid = $id1."000";
$event['id'] = $eventid;
insertintoevent($eventid,$event,$database);
if ($_SESSION["AUTH_ADMIN"]) {
publicizeevent($eventid,$event,$database);
}
}
function getNewEventId() {
$random = rand(0,999);
$id = time();
if ($random<100) {
if ($random<10) {
$id .= "0";
}
$id .= "0";
}
return $id.$random;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment