Exemplo n.º 1
0
     if (count($photos) > 0) {
         $user_id = $photos[0]['user'];
         $categoryphotos = photos_fetch(array('category' => $photos[0]['category']));
         $out .= photos_browse($categoryphotos, true);
     } else {
         $out .= '<h1>Bilden du söker finns inte!</h1>' . "\n";
         $out .= '<p>Den bild du försöker ladda verkar inte finnas kvar på Hamsterpaj, kanske har den blivit borttagen?</p>' . "\n";
     }
     $out .= '<div style="clear: both;"></div>' . "\n";
     break;
 case 'get_full_photo':
     $out .= '<a id="photo"></a>' . "\n";
     $photos = photos_fetch(array('id' => $_GET['id']));
     if (count($photos) > 0) {
         $user_id = $photos[0]['user'];
         $categoryphotos = photos_fetch(array('category' => $photos[0]['category']));
         $out .= photos_display($photos, true);
     } else {
         $out .= '<h1>Bilden du söker finns inte!</h1>' . "\n";
         $out .= '<p>Den bild du försöker ladda verkar inte finnas kvar på Hamsterpaj, kanske har den blivit borttagen?</p>' . "\n";
     }
     $out .= '<div style="clear: both;"></div>' . "\n";
     break;
 case 'get_photo_left':
     $left_id = photos_fetch_next_id(array('id' => $_GET['id'], 'direction' => 'left'));
     $out .= $left_id['id'];
     break;
 case 'get_photo_right':
     $right_id = photos_fetch_next_id(array('id' => $_GET['id'], 'direction' => 'right'));
     $out .= $right_id['id'];
     break;
Exemplo n.º 2
0
function comments_remove($id)
{
    $query = 'SELECT user_id, item_type, item_id FROM user_comments WHERE id = ' . $id . ' LIMIT 1';
    $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    if (mysql_num_rows($result) > 0) {
        $data = mysql_fetch_assoc($result);
        if ($data['item_type'] == 'photos') {
            $photos = photos_fetch(array('id' => $data['item_id'], 'limit' => 1));
            $photo_owner = $photos[0]['user'];
            if (login_checklogin() && ($_SESSION['login']['id'] == $data['user_id'] || $_SESSION['login']['id'] == $photo_owner || is_privilegied('comments_admin'))) {
                $query = 'UPDATE user_comments SET removed=1 WHERE id = ' . $id . ' LIMIT 1';
                mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
            } else {
                die('FEL @ ' . __FILE__ . ' #' . __LINE__);
            }
        } else {
            if (login_checklogin() && ($_SESSION['login']['id'] == $data['user_id'] || is_privilegied('comments_admin'))) {
                $query = 'UPDATE user_comments SET removed=1 WHERE id = ' . $id . ' LIMIT 1';
                mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
            }
        }
    }
}
<?php

require '../include/core/common.php';
require PATHS_INCLUDE . 'libraries/photos.lib.php';
require PATHS_INCLUDE . 'libraries/profile.lib.php';
if (!login_checklogin()) {
    echo 'Men gå och gräv ner dig...';
}
$action = isset($_GET['action']) ? $_GET['action'] : '';
switch ($action) {
    case 'markup_properties':
        switch (isset($_GET['markup_handler']) ? $_GET['markup_handler'] : '') {
            case 'image':
                $html_parameters[] = '{"type": "input_hidden", "id": "choosen_photo_id"}';
                $photos = photos_fetch(array('user' => $_SESSION['login']['id'], 'order-by' => 'up.id', 'order-direction' => 'DESC'));
                $onclick_handlers = array();
                $html_data .= '<h2 style="margin: 0px">Välj en bild ifrån ditt fotoalbum</h2>';
                $html_data .= 'Klicka på en bild ifrån ditt fotoalbum för att infoga den i presentationstexten. <input type="button" class="button_120" value="Ladda upp bilder" id="select_photos_upload" /><br style="clear: both" />';
                $onclick_handlers[] = '{"id": "select_photos_upload", "call": "hp.profile.presentation.change.markup_properties.property_onevent.image_upload()"}';
                $html_data .= '<div id="profile_presentation_change_markup_properties_image">';
                foreach ($photos as $photo) {
                    $onclick_handlers[] = '{"id": "select_photo_photos_' . $photo['id'] . '", "call": "hp.profile.presentation.change.markup_properties.property_onevent.image_select(' . $photo['id'] . ')"}';
                    $html_data .= '<img src="' . IMAGE_URL . 'photos/mini/' . floor($photo['id'] / 5000) . '/' . $photo['id'] . '.jpg" alt="" id="select_photo_photos_' . $photo['id'] . '" />';
                }
                $html_data .= '</div>';
                $html_data .= '<input type="hidden" id="choosen_photo_id" />';
                $html_data .= '<br style="clear: both;" />';
                break;
            case 'link':
                $html_parameters[] = '{"type": "select", "id": "link_type"}';
                $html_parameters[] = '{"type": "input_text", "id": "link_href"}';
Exemplo n.º 4
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 = photos_fetch(array('user' => $user_id, 'order-by' => 'up.id', 'order-direction' => 'DESC', 'limit' => 11));
if (count($photos) > 4) {
    $output .= photos_list_mini($photos);
} elseif (count($photos) > 0) {
    $output .= photos_list_mini($photos);
}
/* 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;
}
if (count($flags) > 0) {
    $output .= '<div style="margin-bottom: 10px;" class="repeat">' . "\n";
    $output .= '<div class="top">' . "\n";
    $output .= '<div class="bottom" style="padding: 10px;">' . "\n";
Exemplo n.º 5
0
             $out .= message_bottom();
         }
         break;
     case 'diary':
         $options['user_id'] = $event['friend_id'];
         $out .= message_top($options);
         $out .= '<span class="timestamp">' . fix_time($event['timestamp']) . '</span>' . "\n";
         $out .= '<a href="/traffa/profile.php?id=' . $event['friend_id'] . '">' . $event['username'] . '</a> ' . "\n";
         $genders = array('f' => 'F', 'm' => 'P');
         $out .= $genders[$event['gender']];
         $out .= date_get_age($event['birthday']) > 0 ? date_get_age($event['birthday']) : '';
         $out .= '<p>Tjoho, läs min senaste bloggning: <a href="' . $event['url'] . '">' . $event['label'] . '</a><br />Och glöm för sablen inte att kommentera!</p>' . "\n";
         $out .= message_bottom();
         break;
     case 'photos':
         $photos = photos_fetch(array('id' => substr($event['url'], 22), 'limit' => 1));
         if (!isset($photos)) {
         } else {
             $options['user_id'] = $event['friend_id'];
             $out .= message_top($options);
             $out .= '<span class="timestamp">' . fix_time($event['timestamp']) . '</span>' . "\n";
             $out .= '<a href="/traffa/profile.php?id=' . $event['friend_id'] . '">' . $event['username'] . '</a> ' . "\n";
             $genders = array('f' => 'F', 'm' => 'P');
             $out .= $genders[$event['gender']];
             $out .= date_get_age($event['birthday']) > 0 ? date_get_age($event['birthday']) : '';
             $out .= photos_list_mini($photos);
             $out .= '<p>Jag är en cool kis, så jag ladda precis upp ett foto. Titta på det och kommentera vetja :) <a href="' . $event['url'] . '">' . $event['label'] . '</a></p>' . "\n";
             $out .= message_bottom();
         }
         break;
 }
Exemplo n.º 6
0
<?php

require '../include/core/common.php';
require PATHS_LIBRARIES . 'photos.lib.php';
$options['user'] = $_GET['user'];
if (isset($_GET['date']) && strtotime($_GET['date']) > 0) {
    $options['date'] = $_GET['date'];
}
$photos = photos_fetch($options);
echo json_encode($photos);
Exemplo n.º 7
0
function photos_date_bar($options)
{
    $query = 'SELECT DISTINCT(date) FROM user_photos WHERE user = "******" ORDER BY date ASC';
    $result = mysql_query($query) or report_sql_error($query, __FILE__, __LINE__);
    while ($data = mysql_fetch_assoc($result)) {
        $months[date('Y-m', strtotime($data['date']))][date('j', strtotime($data['date']))] = $data['date'];
    }
    $out .= rounded_corners_top(array('color' => 'blue_deluxe'));
    $out .= '<select id="photos_date_scroller_dropdown">' . "\n";
    foreach (array_keys($months) as $month) {
        $out .= '<option>' . $month . '</option>' . "\n";
    }
    $out .= '</select>';
    $out .= '<div class="photos_date_scroller">' . "\n";
    foreach ($months as $month => $days) {
        $out .= '<ol>' . "\n";
        for ($i = 1; $i <= date('t', strtotime($month)); $i++) {
            if (isset($days[$i])) {
                $out .= '<li><a href="#" class="photo_date_link" id="photos_' . $month . '-' . $i . '_' . $options['user'] . '">' . $i . '</a></li>' . "\n";
            } else {
                $out .= '<li>' . $i . '</li>' . "\n";
            }
        }
        $out .= '</ol>' . "\n";
    }
    $out .= '</div>' . "\n";
    $out .= '<div id="photos_date_previews">' . "\n";
    $photos = photos_fetch(array('user' => $options['user'], 'date' => $options['date']));
    if (count($photos) > 0) {
        $out .= photos_list_mini($photos);
        $out .= '<br style="clear: both;" />' . "\n";
    }
    $out .= '</div>' . "\n";
    $out .= rounded_corners_bottom();
    return $out;
}
Exemplo n.º 8
0
function profile_presentation_photos_callback($matches)
{
    if (!is_numeric($matches[1])) {
        return 'Hacker där :(';
    }
    $photo_id = $matches[1];
    $photo_object = photos_fetch(array('id' => $photo_id, 'limit' => 1));
    if (count($photo_object) < 1) {
        return '<strong>[Bilden finns inte]</strong>';
    }
    $output .= photos_list($photo_object);
    $output .= '<br style="clear: both;" />';
    return $output;
}
Exemplo n.º 9
0
<?php

require '../include/core/common.php';
require_once PATHS_LIBRARIES . 'photos.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 = photos_fetch(array('user' => $_SESSION['login']['id'], 'force_unread_comments' => true));
    if (count($photos) > 0) {
        echo 'Wosch! Nya kommentarer att besvara!<br />' . "\n";
        echo photos_list($photos);
    } else {
        echo '<italic>Du har inga oläsa fotokommentarer.</italic>';
    }
    echo '<h2>Gamla PM-systemet är borttaget.</h2>' . "\n";
    echo '<italic>Vi har tagit bort gamla PM-systemet. Mer info lär komma inom kort.</italic>';
} else {
    echo '<h1>Du måste vara inloggad</h1>' . "\n";
    echo 'Du måste vara inloggad för att komma åt den här sidan.' . "\n";
}
ui_bottom();
Exemplo n.º 10
0
require '../include/core/common.php';
require PATHS_LIBRARIES . 'photos.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 = photos_fetch(array('order-direction' => 'DESC', 'offset' => $offset, 'limit' => 32));
$out .= photos_list($photos);
//Create Pagination links
if (isset($_GET['page']) && is_numeric($_GET['page'])) {
    $page = intval($_GET['page']);
    if ($page > 1) {
        $out .= ' <a href="' . $_SERVER['PHP_SELF'] . '?page=' . ($page - 1) . '">&laquo; Föregående</a> |';
    }
    if ($page > 0) {
        $out .= ' ' . $page . ' | <a href="' . $_SERVER['PHP_SELF'] . '?page=' . ($page + 1) . '">Nästa &raquo;</a>';
    }
} else {
    $out .= ' <a href="' . $_SERVER['PHP_SELF'] . '?page=2">Nästa &raquo;</a>';
}
ui_top($ui_options);
echo $out;
Exemplo n.º 11
0
$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'])) {
    $query = 'SELECT * FROM blog WHERE id = "' . $_GET['entry'] . '" AND is_removed = 0';
} 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";
        $entry .= rounded_corners_bottom();
    }
    $entry .= '<p>' . nl2br($data['text']) . '</p>' . "\n";
    if ($user_id == $_SESSION['login']['id'] || is_privilegied('remove_diary_post')) {
        $entry .= '<a href="?user_id=' . $user_id . '&action=remove&id=' . $data['id'] . '">Ta bort dagboksinlägget</a>' . "\n";
    }
    // Comments
    $entry .= rounded_corners_top(array('color' => 'blue_deluxe'));
    $entry .= comments_input_draw($data['id'], 'blog');
    $entry .= '<div style="clear: both;"></div>' . "\n";
Exemplo n.º 12
0
function render_full_article($article)
{
    if (empty($article)) {
        $out .= rounded_corners_top(array('color' => 'red'));
        $out .= '<h1>Den här artikeln kunde tyvärr inte hittas</h1>' . "\n";
        $out .= '<a href="?action=list"><< Gå till listan över artiklar</a>' . "\n";
        $out .= rounded_corners_bottom(array('color' => 'red'));
    } else {
        $out .= render_article($article);
        if ($article['photo_category_id'] > 0) {
            $options['category'] = $article['photo_category_id'];
            $photos = photos_fetch($options);
            $out .= '<h2>Tillhörande bilder</h2>' . "\n";
            $out .= photos_list($photos);
        }
        if ($article['showauthor'] == 1) {
            $out .= render_author($article['author']);
        }
        if (isset($article['forum_category_id']) && $article['forum_category_id'] != 0) {
            $all_categories_list = discussion_forum_categories_fetch(array('id' => $article['forum_category_id']));
            $category = array_pop($all_categories_list);
            $forum_security = forum_security(array('action' => 'view_category', 'category' => $category));
            if ($forum_security == true) {
                $path_to_category = discussion_forum_path_to_category(array('id' => $category['id']));
                $locator_options['categories'] = $path_to_category;
                unset($options);
                $options['max_levels'] = 0;
                $options['parent'] = $category['id'];
                $categories = discussion_forum_categories_fetch($options);
                $out .= discussion_forum_categories_list($categories);
                $out .= '<h2>Trådar</h2>' . "\n";
                $post_options['forum_id'] = $category['id'];
                $post_options['threads_only'] = true;
                $post_options['order_by_sticky'] = true;
                $post_options['page_offset'] = $request['page_offset'];
                $post_options['url_lookup'] = true;
                $threads = discussion_forum_post_fetch($post_options);
                //$threads['url'] = $path_to_trailing_category = array_pop($path_to_category) . '/' . $thread['handle'] . '/sida_1.php';
                $out .= discussion_forum_thread_list($threads);
                $path_to_trailing_category = array_pop($path_to_category);
                $out .= '<a href="' . $path_to_trailing_category['url'] . '">Skapa en egen tråd länkad till artikeln</a>' . '<br style="clear: both;" />';
                forum_update_category_session(array('category' => $category, 'threads' => $threads));
            }
        }
        if ($article['commentable'] == 1) {
            $out .= rounded_corners_top(array('color' => 'blue_deluxe'));
            if ($article['rankable'] == 1) {
                $out .= rank_input_draw($article['id'], 'articles');
            }
            $out .= comments_input_draw($article['id'], 'articles');
            $out .= '<div style="clear: both;"></div>' . "\n";
            $out .= rounded_corners_bottom();
            $out .= comments_list($article['id'], 'articles');
        }
    }
    if (is_privilegied('articles_admin')) {
        $out .= '<a href="/artiklar/index.php?action=admin&article=edit&id=' . $article['id'] . '">Ändra i artikeln</a>' . "\n";
    }
    return $out;
}
Exemplo n.º 13
0
function profile_presentation_photos_callback($matches)
{
    $ids = explode(':', $matches[1]);
    foreach ($ids as $id) {
        if (!is_numeric($id)) {
            return 'Hacker där :(';
        }
    }
    $photo_object = photos_fetch(array('id' => $ids, 'limit' => count($ids)));
    if (count($photo_object) < 1) {
        return '<strong>[Bilden finns inte]</strong>';
    }
    // If there are several of the same image
    $photos = array();
    foreach ($ids as $id) {
        foreach ($photo_object as $pic) {
            if ($pic['id'] == $id) {
                $photo = $pic;
            }
        }
        $photos[] = $photo;
    }
    $output .= photos_list($photos);
    $output .= '<br style="clear: both;" />';
    return $output;
}
Exemplo n.º 14
0
             $options['action'] = 'photos';
             $options['label'] = $options['description'];
             $options['item_id'] = $photo_id;
             friends_actions_insert($options);
             $display_successful_message = true;
         }
     }
     if ($display_successful_message) {
         $upload_form .= rounded_corners_top(array('color' => 'blue_deluxe'));
         $upload_form .= 'Bilderna är uppladdade!';
         $upload_form .= rounded_corners_bottom();
     }
     $upload_form .= photos_upload_form(array('user' => $_SESSION['login']['id']));
 }
 if ($_SESSION['login']['id'] == $user_id && !isset($_GET['id']) && !isset($_GET['category'])) {
     $photos = photos_fetch(array('user' => $user_id, 'force_unread_comments' => true));
     if (count($photos) > 0) {
         $output .= '<h1>Foton med nya kommentarer</h1>';
         $output .= photos_list($photos);
     }
 }
 if (isset($user_id)) {
     $output .= '<h1 style="clear: both;">Fotoalbum</h1>';
     $categories = photos_get_categories(array('user' => $user_id));
     $output .= photos_render_categories($categories);
 }
 if (strlen($profile['error_message']) > 0) {
     $ui_options['title'] .= 'Presentationsfel - Hamsterpaj.net';
     ui_top($ui_options);
     echo '<h1>Presentationsfel</h1>';
     echo '<p>' . $profile['error_message'] . '</p>';
Exemplo n.º 15
0
//$output .= '<h1 id="fp_greeting">' . $page_heading . '</h1>' . "\n";
$output .= '<img src="http://images.hamsterpaj.net/the_sims_complete.png" />';
$output .= $_SERVER['REMOTE_ADDR'] == '217.28.207.226' ? '<h1>Va? Har ni inte slutat ännu? Kullaviksskolan är alltså före er!</h1>' : '';
$output .= $_SERVER['REMOTE_ADDR'] == '217.21.232.204' ? '<h2>En blackebergare? Silfverstolpe is watching you!<h2>' : '';
if (login_checklogin() && date_get_age($_SESSION['userinfo']['birthday']) <= 13) {
    $output .= rounded_corners_top(array('color' => 'orange_deluxe'));
    $info2 .= '<img style="float: left; padding: 5px 5px 5px 0;" src="http://images.hamsterpaj.net/13skylt.png" />' . "\n";
    $info2 .= '<h1 style="margin: 0 0 3px 0; font-size: 16px;">Hamsterpaj är ingen barnsida, är du under 13 så använd www.lunarstorm.se</h1>' . "\n";
    $info2 .= '<p style="margin: 0 0 0 0;">Vi som gör Hamsterpaj tycker att medlemmar under 13 år ställer till en massa problem. Om du inte har fyllt 13 borde du läsa vår <a href="http://www.hamsterpaj.net/artiklar/?action=show&id=24">ålderspolicy</a> och fundera på om Hamsterpaj är rätt ställe för dig. Annars rekommenderar vi Lunarstorm, där kan man få häftiga statuspoäng!</p>' . "\n";
    $info2 .= '<div style="clear:both;"></div>' . "\n";
    echo $info2;
    $output .= rounded_corners_bottom(array('color' => 'orange_deluxe'));
}
// Old...
if (login_checklogin()) {
    $photos = photos_fetch(array('limit' => 4, 'order-direction' => 'DESC'));
    $output .= photos_list($photos);
}
$short_months = array('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec');
$events = query_cache(array('query' => 'SELECT * FROM recent_updates WHERE label NOT LIKE "Generalrepetition" ORDER BY id DESC LIMIT 11'));
$output .= '<ol id="fp_event_list">' . "\n";
foreach ($events as $event) {
    $output .= '<li class="event">' . "\n";
    $output .= '<div class="timestamp">' . "\n";
    if ($event['timestamp'] >= strtotime(date('Y-m-d'))) {
        $output .= '<span class="label_today">Idag</span>' . "\n";
        $output .= '<span class="time_today">' . date('H:i', $event['timestamp']) . '</span>' . "\n";
    } elseif ($event['timestamp'] >= strtotime(date('Y-m-d')) - 86400) {
        $output .= '<span class="label_yesterday">Igår</span>' . "\n";
        $output .= '<span class="time_yesterday">' . date('H:i', $event['timestamp']) . '</span>' . "\n";
    } else {