示例#1
0
<?php

$ui_options['ui_modules']['photoblog_calendar'] = 'Fotoblogg Kalender';
$ui_options['ui_modules']['photoblog_albums'] = $photoblog_user['username'] . 's album';
if (is_numeric($uri_parts[3]) && isset($front_access)) {
    $options['id'] = $uri_parts[3];
    $options['user'] = $photoblog_user['id'];
    $photo = end(photoblog_photos_fetch($options));
    if ($photo) {
        $albumid = $photo['category'];
    }
}
if (isset($albumid) || isset($uri_parts[4]) && preg_match('/^[a-zA-Z0-9-_]+$/', $uri_parts[4])) {
    $albumname = $uri_parts[4];
    global $photoblog_user;
    $options = array();
    if (isset($albumid)) {
        $options['id'] = $albumid;
    } else {
        $options['handle'] = $albumname;
    }
    $options['user'] = $photoblog_user['id'];
    if ($albumname !== 'none') {
        $photoblog_album = photoblog_categories_fetch($options);
    } else {
        $photoblog_album = array(array('id' => 0, 'handle' => 'none', 'name' => 'Oalbumiserade foton'));
    }
    if (!$photoblog_album) {
        $out .= '<h2>Det här albumet finns visst inte...</h2>';
    } else {
        $options['category'] = $photoblog_album[0]['id'];
示例#2
0
                    } elseif (isset($_POST['photoblog_photo_properties_' . $matches['photo_id'] . '_date']) && strtolower($_POST['photoblog_photo_properties_' . $matches['photo_id'] . '_date']) == 'idag') {
                        $data['date'] = date('Y-m-d');
                    } elseif (isset($_POST['photoblog_photo_properties_' . $matches['photo_id'] . '_date']) && preg_match('/^20(\\d{2})-(\\d{1,2})-(\\d{1,2})$/', $_POST['photoblog_photo_properties_' . $matches['photo_id'] . '_date'])) {
                        $data['date'] = $_POST['photoblog_photo_properties_' . $matches['photo_id'] . '_date'];
                    } else {
                        throw new Exception('Invalid date!');
                    }
                    if (isset($_SESSION['photoblog']['upload']['upload_tickets'][$_POST['photoblog_upload_ticket']][$matches['photo_id']])) {
                        $data['id'] = $_SESSION['photoblog']['upload']['upload_tickets'][$_POST['photoblog_upload_ticket']][$matches['photo_id']];
                    } else {
                        throw new Exception('Photo does not exist in upload ticket!');
                    }
                    $data['description'] = $_POST['photoblog_photo_properties_' . $matches['photo_id'] . '_description'];
                    photoblog_photos_update($data);
                    $photo_ids[] = $data['id'];
                }
            }
        } else {
            throw new Exception('No ticket id specified or ticket id expired.');
        }
        if (empty($photo_ids)) {
            $out .= 'Något gick lite snett, vi hittade inga av dina foton du just laddade upp.';
            throw new Exception('No photos found when counting uploaded ids before fetching them.');
        } else {
            $out .= '<h2>Här kan du sortera dina foton</h2>';
            $out .= 'Att sortera sina foton är självklart frivilligt, men kan vara bra så att man kan hålla koll på dem. Klicka och dra fotona dit du vill ha dem eller spara. Annars kan du <a href="/fotoalbum">gå direkt till ditt album och se bilderna du laddade upp</a>.';
            $photos = photoblog_photos_fetch(array('id' => $photo_ids), array('save_path' => '/fotoblogg/ladda_upp/spara_sortering'));
            $out .= photoblog_sort_module($photos);
        }
        break;
}
示例#3
0
文件: ordna.php 项目: Rojk/hamsterpaj
<?php

$ui_options['javascripts'][] = 'sorter.js';
$out .= '<div id="photoblog_sort">';
$out .= '<h1>Sortera dina bilder genom att dra och släppa bilderna dit du vill ha dem</h1>';
/*$out .= '<h2>Skapa kategori</h2>';
  $out .= '<p>~Skapa~</p>';*/
$options = array('user' => $_SESSION['login']['id']);
$photos = photoblog_photos_fetch($options);
$options['create_if_not_found'] = false;
$options['id_index'] = true;
$categories = photoblog_categories_fetch($options);
$albums = array();
foreach ($photos as $photo) {
    $albums[$photo['category']][] = '<li id="photo_' . $photo['id'] . '"><img src="' . IMAGE_URL . 'photos/mini/' . floor($photo['id'] / 5000) . '/' . $photo['id'] . '.jpg" title="' . $photo['username'] . '" /><br /><input type="checkbox" name="foo" value="' . $photo['id'] . '" /></li>';
}
foreach ($albums as $id => $album) {
    $out .= '<h2>' . (!strlen($categories[$id]['name']) ? 'Inget namn' : $categories[$id]['name']) . ' <!--<input type="text" value="Ändra namn eller nåt" />--></h2>';
    $out .= '<ul id="album_' . $id . '">';
    $out .= implode('', $album);
    $out .= '</ul>';
}
$out .= '<p><a class="photoblog_sort_save" href="#">Spara ändringar</a> | <a class="photoblog_sort_remove" href="#">Ta bort markerade</a></p>';
$out .= '</div>';
示例#4
0
require '../include/core/common.php';
require_once PATHS_LIBRARIES . 'photoblog.lib.php';
require_once PATHS_LIBRARIES . 'comments.lib.php';
require_once PATHS_LIBRARIES . 'guestbook.lib.php';
$ui_options['stylesheets'][] = 'photos.css';
$ui_options['javascripts'][] = 'photos.js';
$ui_options['stylesheets'][] = 'comments.css';
$ui_options['javascripts'][] = 'comments.js';
$ui_options['title'] = 'Dina nya händelser - Hamsterpaj.net';
$ui_options['menu_path'] = array('traeffa', 'haendelser');
ui_top($ui_options);
if (login_checklogin()) {
    echo '<h1>Nya händelser</h1>' . "\n";
    echo '<h2>Nya fotokommentarer</h2>' . "\n";
    $photos = photoblog_photos_fetch(array('user' => $_SESSION['login']['id'], 'force_unread_comments' => true));
    if (count($photos) > 0) {
        echo 'Wosch! Nya kommentarer att besvara!<br />' . "\n";
        echo '<ul class="photos_list">' . "\n";
        foreach ($photos as $photo) {
            $photo['description'] = mb_strlen($photo['description'], 'UTF8') > 19 ? mb_substr($photo['description'], 0, 17, 'UTF8') . '...' : $photo['description'];
            echo '<li>' . "\n";
            echo '<a href="/fotoblogg/' . $photo['username'] . '/' . $photo['id'] . '"><img src="' . IMAGE_URL . 'photos/thumb/' . floor($photo['id'] / 5000) . '/' . $photo['id'] . '.jpg" title="' . $photo['username'] . '" /></a>';
            echo '<p><a href="/fotoblogg/' . $photo['username'] . '/' . $photo['id'] . '">' . $photo['description'] . '</a>';
            echo $photo['user'] == $_SESSION['login']['id'] && $photo['unread_comments'] > 0 ? '<strong>(' . $photo['unread_comments'] . ')</strong>' : '';
            echo '</p>' . "\n";
            echo '</li>' . "\n";
        }
        echo '</ul>' . "\n";
    } else {
        echo '<italic>Du har inga oläsa fotokommentarer.</italic>';
示例#5
0
         $data = array('deleted' => 1, 'id' => $photo_info['id']);
         photoblog_photos_update($data);
     }
     echo 'Du har sedermera uppdaterat ditt photo.';
     break;
 case 'photos_remove':
     if (!isset($_GET['photos'])) {
         throw new Exception('No input');
     }
     $photos = explode('|', trim($_GET['photos'], '|'));
     foreach ($photos as $photo) {
         if (!is_numeric($photo)) {
             throw new Exception('Bad input');
         }
         $photo_options = array('id' => $photo);
         $photo_info = photoblog_photos_fetch($photo_options);
         if (!count($photo_info)) {
             throw new Exception('One of removed photos did not exist.');
         }
         $photo_info = $photo_info[0];
         if ($photo_info['user'] != $_SESSION['login']['id'] && !is_privilegied('photoblog_photo_remove')) {
             throw new Exception('Removing photo without the right rights.');
         }
         $data = array('deleted' => 1, 'id' => $photo);
         photoblog_photos_update($data);
     }
     break;
 case 'photo_putback':
     if (!isset($_GET['photo'])) {
         throw new Exception('No input');
     }
示例#6
0
function photoblog_dates_fetch($options)
{
    $photo_options = array('user' => $options['user']);
    $photos = photoblog_photos_fetch($photo_options);
    $return = array();
    foreach ($photos as $photo) {
        $time = strtotime($photo['date']);
        list($year, $month, $day) = explode('-', date('Y-m-d', $time));
        $return[$year][$month][$day] = true;
    }
    natsort($return);
    return $return;
}
示例#7
0
require '../include/core/common.php';
require_once PATHS_LIBRARIES . 'photoblog.lib.php';
$ui_options['stylesheets'][] = 'photos.css';
$ui_options['menu_path'] = array('traeffa', 'new_photos');
$ui_options['title'] = 'Nya foton - Hamsterpaj.net';
$out .= '<h1>Nya foton</h1>';
//Get pagenumber
$page = 1;
if (isset($_GET['page']) && is_numeric($_GET['page'])) {
    $page = intval($_GET['page']);
    if ($page < 1 || $page > 999) {
        $page = 1;
    }
}
$offset = ($page - 1) * 32;
$photos = photoblog_photos_fetch(array('order-direction' => 'DESC', 'offset' => $offset, 'limit' => 32));
$out .= '<ul class="photos_list">' . "\n";
foreach ($photos as $photo) {
    $photo['description'] = mb_strlen($photo['description'], 'UTF8') > 19 ? mb_substr($photo['description'], 0, 17, 'UTF8') . '...' : $photo['description'];
    $out .= '<li>' . "\n";
    $out .= '<a href="/fotoblogg/' . $photo['username'] . '/' . $photo['id'] . '"><img src="' . IMAGE_URL . 'photos/thumb/' . floor($photo['id'] / 5000) . '/' . $photo['id'] . '.jpg" title="' . $photo['username'] . '" /></a>';
    $out .= '<p><a href="/fotoblogg/' . $photo['username'] . '/' . $photo['id'] . '">' . $photo['description'] . '</a>';
    $out .= $photo['user'] == $_SESSION['login']['id'] && $photo['unread_comments'] > 0 ? '<strong>(' . $photo['unread_comments'] . ')</strong>' : '';
    $out .= '</p>' . "\n";
    $out .= '</li>' . "\n";
}
$out .= '</ul>' . "\n";
//Create Pagination links
if (isset($_GET['page']) && is_numeric($_GET['page'])) {
    $page = intval($_GET['page']);
    if ($page > 1) {
示例#8
0
    $ui_options['stylesheets'][] = 'profile_themes/' . $profile['profile_theme'] . '.css';
}
/* Start of profile */
$output .= profile_top($profile);
/* Including Profile-head */
$output .= profile_head($profile);
/* Presentation changed... */
if (isset($_GET['show_change_profile_notice'])) {
    $rounded_corners_config['color'] = 'orange_deluxe';
    $output .= rounded_corners_top($rounded_corners_config);
    $output .= 'Blev det inte riktigt som du hade tänkt dig? Gå tillbaka och 
		<a href="/installningar/profilesettings.php">ändra din presentation</a> igen!';
    $output .= rounded_corners_bottom($rounded_corners_config);
}
/* Photos */
$photos = photoblog_photos_fetch(array('user' => $user_id, 'order-by' => 'up.id', 'order-direction' => 'DESC', 'limit' => 11));
if (count($photos) > 0) {
    $output .= '<ul class="photos_list_mini">' . "\n";
    foreach ($photos as $photo) {
        $output .= '<li>' . "\n";
        $output .= '<a href="/fotoblogg/' . $photo['username'] . '/' . $photo['id'] . '" id="' . $photo['id'] . '"><img src="' . IMAGE_URL . 'photos/mini/' . floor($photo['id'] / 5000) . '/' . $photo['id'] . '.jpg" /></a>';
        $output .= '</li>' . "\n";
    }
    $output .= '</ul>' . "\n";
}
/* User flags */
$query = 'SELECT ufl.* FROM user_flags AS uf, user_flags_list AS ufl WHERE user = "******" AND ufl.id = uf.flag';
$result = mysql_query($query) or die(report_sql_error($query));
while ($data = mysql_fetch_assoc($result)) {
    $flags[] = $data;
}
示例#9
0
        case 'ban':
            if (!isset($_POST['days']) || !is_numeric($_POST['days'])) {
                throw new Exception('Dagar kan ju endast beskrivas med siffror');
            }
            $options = array('user_id' => $photoblog_user['id'], 'days' => $_POST['days']);
            photoblog_forbid_upload($options);
            $out .= '<h2>Bannat! Hihihahahahohoho</h2>';
            break;
    }
}
$out .= '<p>Endast admins här pl0x.</p>';
$out .= '<h1>Let\'s administrera this sucker!</h1>';
$photo_options = array('user' => $photoblog_user['id'], 'index_by_id' => true);
$all_photos = photoblog_photos_fetch($photo_options);
$photo_options['include_removed_photos'] = true;
$deleted_photos = photoblog_photos_fetch($photo_options);
if (is_privilegied('photoblog_upload_forbid')) {
    $out .= '<form action="/fotoblogg/' . $photoblog_user['username'] . '/admin/ban" method="post">';
    $out .= '<ol>';
    $out .= '<li><strong>Blockera</strong> den här personen från att <strong>ladda upp bilder</strong> i <input type="text" style="width: 40px" name="days" value="7" /> dagar <input type="submit" value="Banna!" /><br />Tips: för att ta bort en ban kan du skriva in -100 eller nåt.</li>';
    $out .= '</ol>';
    $out .= '</form>';
}
function photoblogadmin_photo($photo)
{
    global $photoblog_user;
    $thumb_url = photoblog_photo_thumb_url($photo['id']);
    $full_url = photoblog_photo_full_url($photo['id']);
    $info = '<div class="photoblog_info" style="display: none">';
    $info .= '<form method="post" action="/ajax_gateways/photoblog.json.php?action=photo_edit">';
    $info .= '<input type="hidden" value="' . $photo['id'] . '" name="edit_id" />';
示例#10
0
function photoblog_viewer_albums_list($options)
{
    global $photoblog_user;
    $photo_options = array('user' => $options['user_id']);
    $albums = photoblog_categories_fetch($photo_options);
    $album_ids = array(0);
    foreach ($albums as $album) {
        $album_ids[] = $album['id'];
    }
    $photo_options['index_by_category'] = true;
    $photo_options['category'] = $album_ids;
    // this should be better
    //$photo_options['category_limit'] = true;
    $photos = photoblog_photos_fetch($photo_options);
    // remove albums with no photos
    foreach ($albums as $key => $album) {
        if (!count($photos[$album['id']])) {
            unset($albums[$key]);
        }
    }
    if (count($photos[0])) {
        $albums[] = array('id' => 0, 'name' => 'Oalbumiserade foton', 'handle' => 'none');
    }
    $ret = '<dt style="display: none" id="photoblog_prevmonth"><a id="prevmonth" title="F&ouml;reg&aring;ende m&aring;nad" href="#prev-month">F&ouml;reg&aring;ende m&aring;nad</a></dt>';
    $last = count($albums) - 1;
    $current = 0;
    foreach ($albums as $album) {
        $class = ' class="';
        if ($current == 0) {
            $class .= 'first-image';
        }
        if ($current == $last) {
            $class .= 'last-image';
        }
        $class .= '"';
        $album['name'] = empty($album['name']) ? 'Ingetnamnalbum' : $album['name'];
        $album_url = '/fotoblogg/' . $photoblog_user['username'] . '/album/' . $album['handle'];
        $ret .= sprintf('<dt><a href="%s">%s</a></dt>', $album_url, $album['name']);
        $id = $photos[$album['id']][0]['id'];
        $dir = floor($id / 5000);
        $photo_class = $current == 0 ? 'class="photoblog_active"' : '';
        $ret .= sprintf('<dd %s><a %s href="#image-%d" rel="/fotoblogg/' . $photoblog_user['username'] . '/album/' . $album['handle'] . '"><img width="50" height="38" src="%sphotos/mini/%d/%d.jpg" alt="" /></a></dd>', $class, $photo_class, $id, IMAGE_URL, $dir, $id);
        $current++;
    }
    $no_album = photoblog_photos_fetch(array('user' => $_SESSION['login']['id'], 'category' => 0));
    $ret .= '<dt style="display: none;" id="photoblog_nextmonth"><a id="nextmonth" title="N&auml;sta m&aring;nad" href="#next-month">N&auml;sta m&aring;nad</a></dt>';
    return array($ret, $photos[$albums[0]['id']][0]);
}