示例#1
0
 require '../include/core/common.php';
 require_once PATHS_LIBRARIES . 'photoblog.lib.php';
 if (isset($_GET['action'])) {
     $action = $_GET['action'];
 } else {
     throw new Exception('No action in get data recieved');
 }
 switch ($action) {
     case 'photo_fetch':
         if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
             throw new Exception('No ID or faulty ID recieved');
         }
         // fetch a single image
         if (!isset($_GET['month'])) {
             $options['id'] = $_GET['id'];
             friends_notices_set_read(array('action' => 'photos', 'item_id' => $_GET['id']));
         } else {
             if (!is_numeric($_GET['month'])) {
                 throw new Exception('Month not numerical.');
             }
             $options['user'] = $_GET['id'];
             $options['month'] = $_GET['month'];
         }
         $options['order-by'] = 'up.date';
         $photo = photoblog_photos_fetch($options);
         echo json_encode($photo);
         break;
     case 'comments_fetch':
         if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
             throw new Exception('No Photo-ID or faulty ID recieved');
         }
示例#2
0
文件: diary.php 项目: Rojk/hamsterpaj
        $options['label'] = $_POST['title'];
        $options['item_id'] = $entry_id;
        friends_actions_insert($options);
        mysql_query($ualquery) or report_sql_error($ualquery, __FILE__, __LINE__);
    } else {
        mysql_query($updatequery);
    }
}
$params['user_id'] = $user_id;
$profile = profile_fetch($params);
$ui_options['stylesheets'][] = 'profile_themes/' . $profile['profile_theme'] . '.css';
$output .= profile_mini_page($profile);
/* Fetch and render an entry */
if (isset($_GET['entry']) && is_numeric($_GET['entry'])) {
    $query = 'SELECT * FROM blog WHERE id = "' . $_GET['entry'] . '" AND is_removed = 0';
    friends_notices_set_read(array('action' => 'diary', 'item_id' => $_GET['entry']));
} else {
    $query = 'SELECT * FROM blog WHERE user = "******" AND is_removed = 0 ORDER BY id DESC LIMIT 1';
}
$result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
if (mysql_num_rows($result) == 1) {
    $data = mysql_fetch_assoc($result);
    $highlight_month = $data['date'];
    $entry .= '<h1>' . $data['date'] . ': ' . $data['title'] . '</h1>' . "\n";
    // Lef-91 adds photos from the same date
    $photos = photos_fetch(array('date' => $data['date'], 'user' => $user_id));
    if (isset($photos)) {
        $entry .= rounded_corners_top();
        $entry .= '<h2 style="margin-top: 0;">Foton från samma datum</h2>' . "\n";
        $entry .= photos_list_mini($photos);
        $entry .= '<div style="clear: both;"></div>' . "\n";