Esempio n. 1
0
<?php

/**
 *    OpenSource-SocialNetwork
 *
 * @package   (Informatikon.com).ossn
 * @author    OSSN Core Team <*****@*****.**>
 * @copyright 2014 iNFORMATIKON TECHNOLOGIES
 * @license   General Public Licence http://opensource-socialnetwork.com/licence
 * @link      http://www.opensource-socialnetwork.com/licence
 */
$add = new OssnPhotos();
if ($add->AddPhoto(input('album'), 'ossnphoto', input('privacy'))) {
    redirect(REF);
} else {
    redirect(REF);
}
Esempio n. 2
0
<?php

/**
 * Acció crear nou álbum i afegir la foto
 *
 * @author    Dani Marti <*****@*****.**>
 * @license   GPL
 */
$add = new OssnPhotos();
$album = 130;
//Exist album
$access = 2;
//'OSSN_PUBLIC';
//check if album guid is not less than 0 and validate photo uploader
// if (!empty($album) && $album > 0 && $this->album->album->owner_guid == ossn_loggedin_user()->guid) {
//    error_log("check passed! album_owner: " .  $this->album->album->owner_guid);
// }
if ($add->AddPhoto($album, 'ossnphoto', $access)) {
    //130 is object exist Album  	redirect(REF);
    redirect(REF);
} else {
    redirect(REF);
}
Esempio n. 3
0
$albums = new OssnAlbums();
$photos = $albums->GetAlbums($params['user']->guid);
$albums->count = true;
$count = $albums->GetAlbums($params['user']->guid);
$profiel_photo = ossn_site_url("avatar/{$params['user']->username}/larger");
$pphotos_album = ossn_site_url("album/profile/{$params['user']->guid}");
$profile_covers_url = ossn_site_url("album/covers/profile/{$params['user']->guid}");
$profile_cover = ossn_site_url("cover/{$params['user']->username}/1");
//show profile pictures album
echo "<li>\n\t<a href='{$pphotos_album}'><img src='{$profiel_photo}' class='pthumb' />\n\t <div class='ossn-album-name'>" . ossn_print('profile:photos') . "</div></a>\n\t</li>";
//show profile cover photos
echo "<li>\n\t<a href='{$profile_covers_url}'><img src='{$profile_cover}' class='pthumb' />\n\t <div class='ossn-album-name'>" . ossn_print('profile:covers') . "</div></a>\n\t</li>";
if ($photos) {
    foreach ($photos as $photo) {
        if (ossn_access_validate($photo->access, $photo->owner_guid)) {
            $images = new OssnPhotos();
            $image = $images->GetPhotos($photo->guid);
            if (isset($image->{0}->value)) {
                $image = str_replace('album/photos/', '', $image->{0}->value);
                $image = ossn_site_url() . "album/getphoto/{$photo->guid}/{$image}?size=album";
            } else {
                $image = ossn_site_url() . 'components/OssnPhotos/images/nophoto-album.png';
            }
            $view_url = ossn_site_url() . 'album/view/' . $photo->guid;
            if (ossn_access_validate($photo->access, $photo->owner_guid)) {
                echo "<li>\n\t<a href='{$view_url}'><img src='{$image}' class='pthumb' />\n\t <div class='ossn-album-name'>{$photo->title}</div></a>\n\t</li>";
            }
        }
    }
}
?>
Esempio n. 4
0
/**
 * Ossn Photos page handler
 * @pages:
 *       view,
 *    user,
 *       add,
 *       viewer
 *
 * @return mixed contents
 */
function ossn_photos_page_handler($album)
{
    $page = $album[0];
    if (empty($page)) {
        ossn_error_page();
    }
    switch ($page) {
        case 'view':
            if (isset($album[1])) {
                $title = ossn_print('photos');
                $photo['photo'] = $album[1];
                $view = new OssnPhotos();
                $image = $view->GetPhoto($photo['photo']);
                $photo['entity'] = $image;
                //redirect user to home page if image is empty
                if (empty($image)) {
                    redirect();
                }
                //throw 404 page if there is no album access
                $albumget = ossn_albums();
                $owner = $albumget->GetAlbum($image->owner_guid)->album;
                if ($owner->access == 3) {
                    if (!ossn_validate_access_friends($owner->owner_guid)) {
                        ossn_error_page();
                    }
                }
                //shows widget back button
                $addphotos = array('text' => ossn_print('back'), 'href' => 'javascript::;', 'class' => 'button-grey');
                $control = ossn_plugin_view('output/url', $addphotos);
                $contents = array('title' => ossn_print('photos'), 'content' => ossn_plugin_view('photos/pages/photo/view', $photo), 'controls' => $control);
                //set page layout
                $module['content'] = ossn_set_page_layout('media', $contents);
                $content = ossn_set_page_layout('contents', $module);
                echo ossn_view_page($title, $content);
            }
            break;
        case 'user':
            if (isset($album[1]) && isset($album[2]) && $album[1] == 'view') {
                $title = ossn_print('photos');
                $photo['photo'] = $album[2];
                $type = input('type');
                $view = new OssnPhotos();
                $image = $view->GetPhoto($photo['photo']);
                $photo['entity'] = $image;
                //redirect user if photo is empty
                if (empty($image->value)) {
                    redirect();
                }
                $addphotos = array('text' => ossn_print('back'), 'href' => 'javascript::;', 'class' => 'button-grey');
                $control = ossn_plugin_view('output/url', $addphotos);
                $contents = array('title' => 'Photos', 'content' => ossn_plugin_view('photos/pages/profile/photos/view', $photo), 'controls' => $control);
                //set page layout
                $module['content'] = ossn_set_page_layout('media', $contents);
                $content = ossn_set_page_layout('contents', $module);
                echo ossn_view_page($title, $content);
            }
            break;
        case 'cover':
            if (isset($album[1]) && isset($album[2]) && $album[1] == 'view') {
                $title = ossn_print('cover:view');
                $photo['photo'] = $album[2];
                $type = input('type');
                $image = ossn_get_entity($photo['photo']);
                $photo['entity'] = $image;
                //redirect user if photo is empty
                if (empty($image->value)) {
                    redirect();
                }
                $addphotos = array('text' => ossn_print('back'), 'href' => 'javascript::;', 'class' => 'button-grey');
                $control = ossn_plugin_view('output/url', $addphotos);
                $contents = array('title' => 'Photos', 'content' => ossn_plugin_view('photos/pages/profile/covers/view', $photo), 'controls' => $control);
                //set page layout
                $module['content'] = ossn_set_page_layout('media', $contents);
                $content = ossn_set_page_layout('contents', $module);
                echo ossn_view_page($title, $content);
            }
            break;
        case 'add':
            //add photos (ajax)
            if (!ossn_is_xhr()) {
                ossn_error_page();
            }
            echo ossn_plugin_view('output/ossnbox', array('title' => ossn_print('add:photos'), 'contents' => ossn_plugin_view('photos/pages/photos/add'), 'callback' => '#ossn-photos-submit'));
            break;
        case 'viewer':
            //ossn image viewer currently works for profile images
            $image = input('user');
            $url = ossn_site_url("avatar/{$image}");
            $media = "<img src='{$url}' />";
            $photo_guid = get_profile_photo_guid(ossn_user_by_username($image)->guid);
            //set viewer sidebar (comments and likes)
            $sidebar = ossn_plugin_view('photos/viewer/comments', array('entity_guid' => $photo_guid));
            echo ossn_plugin_view('output/viewer', array('media' => $media, 'sidebar' => $sidebar));
            break;
        default:
            ossn_error_page();
            break;
    }
}
Esempio n. 5
0
 /**
  * Delete Album
  *
  * @param integer $guid Album Guid
  *
  * @return boolean
  */
 public function deleteAlbum($guid)
 {
     if (!empty($guid)) {
         $album = $this->GetAlbum($guid);
         if ($album->album->owner_guid == ossn_loggedin_user()->guid || ossn_isAdminLoggedin()) {
             $photos = new OssnPhotos();
             foreach ($album->photos as $photo) {
                 $photos->photoid = $photo->guid;
                 $photos->deleteAlbumPhoto();
             }
             if ($album->album->deleteObject()) {
                 return true;
             }
         }
     }
     return false;
 }