}
    return CALURL . "{$view}#" . substr($sqldate, 8, 2) . "-{$id}";
}
function pubdate($sqldate)
{
    $date = strtotime($sqldate);
    return date("D, d M Y", $date) . " 00:00:00 GMT";
}
# Generate the XML for all recent entries.
$result = mysql_query("SELECT calevent.id as id, newsflash, tinytitle, eventdate, eventtime, timedetails, locname, address, locdetails, printdescr FROM calevent, caldaily WHERE caldaily.id = calevent.id AND eventstatus != \"C\" AND eventstatus != \"E\" AND eventstatus != \"S\" ORDER BY calevent.modified DESC LIMIT 1, 10", $conn) or die(mysql_error());
$date = "";
while ($record = mysql_fetch_array($result)) {
    # Output an event
    print "    <item>\r\n";
    print "      <title>" . date("D, M d ", strtotime($record['eventdate'])) . hmmpm($record["eventtime"]) . " " . ($record["newsflash"] ? "[!] " : "") . htmlspecialchars($record["tinytitle"]) . "</title>\r\n";
    print "      <link>" . eventlink($record["eventdate"], $record["id"]) . "</link>\r\n";
    print "      <pubDate>" . pubdate($record["eventdate"]) . "</pubDate>\r\n";
    print "      <description>";
    date("D, d M Y ", strtotime($record['eventdate']));
    print hmmpm($record["eventtime"]);
    if ($record["timedetails"]) {
        print ' (' . htmlspecialchars($record[timedetails]) . ')';
    }
    print "\r\n        ";
    if ($record["locname"]) {
        print htmlspecialchars($record["locname"]) . ", ";
    }
    print htmlspecialchars($record["address"]);
    if ($record["locdetails"]) {
        print " (" . htmlspecialchars($record["locdetails"]) . ")";
    }
Exemple #2
0
             # this should never happen but just in case...
             $daylabel = $record["eventdate"];
         }
     }
     print "    <item>\n";
     print "      <title>{$daylabel} ------------</title>\n";
     print "      <link>" . datelink($record["eventdate"]) . "</link>\n";
     print "      <pubDate>" . pubdate($record["eventdate"]) . "</pubDate>\r\n";
     print "      <description>Whole day's events</description>\n";
     print "    </item>\n";
     $date = $record["eventdate"];
 }
 # Output an event
 print "    <item>\r\n";
 print "      <title>" . ($record['newsflash'] ? "[!] " : "") . hmmpm($record['eventtime']) . " " . htmlspecialchars($record['tinytitle']) . "</title>\r\n";
 print "      <link>" . eventlink($record['eventdate'], $record['id']) . "</link>\r\n";
 print "      <pubDate>" . pubdate($record['eventdate']) . "</pubDate>\r\n";
 print "      <description>";
 print hmmpm($record['eventtime']);
 if ($record['timedetails']) {
     print " (" . htmlspecialchars($record['timedetails']) . ")";
 }
 print "\r\n        ";
 if ($record['locname']) {
     print htmlspecialchars($record['locname']) . ", ";
 }
 print htmlspecialchars($record['address']);
 if ($record['locdetails']) {
     print " (" . htmlspecialchars($record['locdetails']) . ")";
 }
 print "\r\n        ";
Exemple #3
0
function kalender_listoutput()
{
    global $komsOK, $tpl, $eid, $data, $data_id, $gday, $month, $year, $days, $arr_day, $title_liste, $view, $allgAr;
    //Listbegin
    $tpl->set_ar_out(array('TITLE' => $eid ? $data_id[$eid]['title'] : $title_liste, 'TITLE_ALIGN' => $eid ? '' : ' align="center"'), "listbegin");
    //Detail
    if ($eid) {
        $aus['display'] = 'style="display:none"';
        $aus['DETAIL_DATE'] = date('d.m.Y', $data_id[$eid]['time']);
        $aus['DETAIL_TIME'] = date('H:i', $data_id[$eid]['time']);
        $aus['DETAIL_TEXT'] = BBcode($data_id[$eid]['text']);
        $aus['ID'] = $eid;
        $viewl = $allgAr['kalender_standard_list'];
        if (preg_match('%\\?kalender-v([0|1])%i', $_SERVER['HTTP_REFERER'], $match)) {
            $viewl = $match[1];
        }
        $aus['BACK_LINK'] = 'index.php?kalender-v' . $viewl . '-m' . date('m', $data_id[$eid]['time']) . '-y' . date('Y', $data_id[$eid]['time']);
        if (!$komsOK) {
            $tpl->set_ar_out($aus, 'detail');
        } else {
            if ((loggedin() or chk_antispam('kalender_komms')) and $komsOK and !empty($_POST['name']) and !empty($_POST['text'])) {
                if (loggedin()) {
                    $name = $_SESSION['authname'];
                    $userid = $_SESSION['authid'];
                } else {
                    $name = escape($_POST['name'], 'string') . ' (Gast)';
                    $userid = 0;
                }
                $text = escape($_POST['text'], 'string');
                db_query("INSERT INTO `prefix_koms` (`name`,`userid`,`text`,`time`,`uid`,`cat`) VALUES ('" . $name . "', " . $userid . ", '" . $text . "','" . time() . "', " . $eid . ", 'KALENDER')");
            }
            if (loggedin()) {
                $aus['uname'] = $_SESSION['authname'];
                $aus['readonly'] = 'readonly';
            } else {
                $aus['uname'] = '';
                $aus['readonly'] = '';
            }
            $aus['ANTISPAM'] = get_antispam('kalenderkom', 0);
            $aus['text'] = bbcode($aus['text']);
            $tpl->set_ar_out($aus, 'detail');
            $tpl->set_ar_out($aus, 'commentstart');
            $erg = db_query("SELECT `id`, `name`, `userid`, `text`, `time` FROM `prefix_koms` WHERE `uid` = " . $eid . " AND `cat` = 'KALENDER' ORDER BY `id` DESC");
            $anz = db_num_rows($erg);
            if ($anz == 0) {
                echo 'Keine Kommentare vorhanden';
            } else {
                while ($r1 = db_fetch_assoc($erg)) {
                    if (has_right(-7, 'kalender')) {
                        $del = ' <a href="index.php?kalender-v1-e' . $eid . '-d' . $r1['id'] . '"><img src="include/images/icons/del.gif" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
                    }
                    $r1['zahl'] = $anz;
                    $r1['avatar'] = get_avatar($r1['userid']);
                    $r1['time'] = post_date($r1['time'], 1) . $del;
                    $r1['text'] = bbcode($r1['text']);
                    $tpl->set_ar_out($r1, 'comments');
                    $anz--;
                }
            }
        }
        $tpl->out('commentend');
        // Kommentare Ende
    } elseif ($view == 0) {
        for ($i = 0; $i < $days; $i++) {
            $date = mktime(0, 0, 0, $month, $i + 1, $year);
            $text = '';
            if (isset($data[$date])) {
                foreach ($data[$date] as $eventinfo) {
                    $text .= eventlink($tpl, $view, $eventinfo);
                    // bbcode anwenden
                    $eventinfo["text"] = BBCode($eventinfo["text"]);
                    $tooltips .= $tpl->set_ar_get($eventinfo, "tooltip");
                }
            }
            $aus['LIST_I'] = $i + 1;
            $aus['LIST_D'] = $arr_day[date('w', mktime(0, 0, 0, $month, $i + 1, $year))];
            $aus['LIST_T'] = $text;
            $class = $i % 2 ? 'Cnorm' : 'Cmite';
            $aus['LIST_CLASS'] = $i + 1 == date('j') && $month == date('n') && $year == date('Y') ? 'Cdark' : $class;
            $tpl->set_ar_out($aus, 'listitem');
            unset($aus);
        }
        showTooltips($tpl, $tooltips);
    } elseif ($view == 1) {
        // Nur ein Tag
        if (isset($data) && !empty($gday)) {
            $date = mktime(0, 0, 0, $month, $gday, $year);
            $i = 1;
            $tooltips = '';
            if (isset($data[$date])) {
                foreach ($data[$date] as $eventinfo) {
                    $text = '';
                    $text .= eventlink($tpl, $view, $eventinfo);
                    $aus['LIST_I'] = $arr_day[date('w', $date)];
                    $aus['LIST_D'] = date('H:i', $eventinfo['time']);
                    $aus['LIST_T'] = $text;
                    $class = $i % 2 ? 'Cnorm' : 'Cmite';
                    $aus['LIST_CLASS'] = $i + 1 == date('j') && $month == date('n') && $year == date('Y') ? 'Cdark' : $class;
                    $tpl->set_ar_out($aus, 'listitem');
                    unset($aus);
                    $i++;
                    // bbcode anwenden
                    $eventinfo["text"] = BBCode($eventinfo["text"]);
                    $tooltips .= $tpl->set_ar_get($eventinfo, "tooltip");
                }
            }
            showTooltips($tpl, $tooltips);
            // Ganze Liste
        } elseif (isset($data)) {
            $i = 1;
            foreach ($data as $date => $data1) {
                $text = '';
                foreach ($data1 as $eventinfo) {
                    $text .= eventlink($tpl, $view, $eventinfo);
                }
                $aus['LIST_I'] = date('d.m.Y', $date);
                $aus['LIST_D'] = $arr_day[date('w', $date)];
                $aus['LIST_T'] = $text;
                $class = $i % 2 ? 'Cnorm' : 'Cmite';
                $aus['LIST_CLASS'] = $i + 1 == date('j') && $month == date('n') && $year == date('Y') ? 'Cdark' : $class;
                $tpl->set_ar_out($aus, 'listitem');
                unset($aus);
                $i++;
                // bbcode anwenden
                $eventinfo["text"] = BBCode($eventinfo["text"]);
                $tooltips .= $tpl->set_ar_get($eventinfo, "tooltip");
            }
            showTooltips($tpl, $tooltips);
        } else {
            $aus['LIST_I'] = '-';
            $aus['LIST_D'] = '-';
            $aus['LIST_T'] = '-';
            $aus['LIST_CLASS'] = 'Cnorm';
            $tpl->set_ar_out($aus, 'listitem');
            unset($aus);
        }
    }
    $tpl->out('listend');
}