<?php

$options['output'] .= photoblog_calendar(PHOTOBLOG_CURRENT_USER, (int) PHOTOBLOG_CURRENT_MONTH, (int) PHOTOBLOG_CURRENT_YEAR);
Example #2
0
            if (!login_checklogin()) {
                throw new Exception('Only users can post comments.');
            }
            $options['photo_id'] = $_GET['id'];
            $options['comment'] = $_POST['comment'];
            $options['author'] = $_SESSION['login']['id'];
            photoblog_comments_add($options);
            break;
        case 'calendar_render':
            if (!isset($_GET['user_id'], $_GET['month'], $_GET['year'])) {
                throw new Exception('No input.');
            }
            if (!is_numeric($_GET['user_id']) || !is_numeric($_GET['month']) || !is_numeric($_GET['year'])) {
                throw new Exception('Not numerical input.');
            }
            echo photoblog_calendar($_GET['user_id'], $_GET['month'], $_GET['year']);
            break;
        case 'sort_save':
            photoblog_sort_save($_POST['data']);
            break;
        default:
            throw new Exception('Action not found');
            break;
    }
} catch (Exception $error) {
    $options['type'] = 'error';
    $options['title'] = 'Nu blev det fel här';
    $options['message'] = $error->getMessage();
    $options['collapse_link'] = 'Visa felsökningsinformation';
    $options['collapse_information'] = preint_r($error, true);
    $out .= ui_server_message($options);
    $out .= '<div id="photoblog_calendar_month">' . "\n";
    $out .= '<a href="">&laquo;</a>' . "\n";
    $out .= '<span>' . date('F', $date) . '</span>' . "\n";
    $out .= '<a href="">&raquo;</a>' . "\n";
    $out .= '</div>' . "\n";
    $out .= '<table>' . "\n";
    $out .= '<tr><th>M</th><th>T</th><th>O</th><th>T</th><th>F</th><th>L</th><th>S</th></tr>' . "\n";
    $out .= '<tr>';
    for ($i = 1; $i <= $offset; $i++) {
        $out .= '<td></td>' . "\n";
    }
    for ($day = 1; $day <= $daysInMonth; $day++) {
        if (($day + $offset) % 7 == 0 && $day != 1) {
            $out .= '</tr><tr>' . "\n";
            $rows++;
        }
        $out .= '<td>' . $day . '</td>' . "\n";
    }
    while ($day + $offset <= $rows * 7) {
        $out .= '<td></td>' . "\n";
        $day++;
    }
    $out .= '</tr>' . "\n";
    $out .= '</table>' . "\n";
    $out .= '<div id="photoblog_calendar_year">' . "\n";
    $out .= '<span class="photoblog_calendar_year_pre">2007</span><span class="photoblog_calendar_year_after">2008</span>' . "\n";
    $out .= '</div>' . "\n";
    return $out;
}
$options['output'] .= photoblog_calendar(12, 2008);