コード例 #1
0
ファイル: ossn_com.php プロジェクト: nongdanit-nongdanit/ossn
function ossn_search_page($pages)
{
    $page = $pages[0];
    if (empty($page)) {
        $page = 'search';
    }
    ossn_trigger_callback('page', 'load:search');
    switch ($page) {
        case 'search':
            $query = input('q');
            $type = input('type');
            $title = ossn_print("search:result", array($query));
            if (empty($type)) {
                $params['type'] = 'users';
            } else {
                $params['type'] = $type;
            }
            $type = $params['type'];
            if (ossn_is_hook('search', "type:{$type}")) {
                $contents['contents'] = ossn_call_hook('search', "type:{$type}", array('q' => input('q')));
            }
            $contents = array('content' => ossn_plugin_view('search/pages/search', $contents));
            $content = ossn_set_page_layout('search', $contents);
            echo ossn_view_page($title, $content);
            break;
        default:
            ossn_error_page();
            break;
    }
}
コード例 #2
0
function chatroom_page()
{
    $title = 'Chatroom';
    $contents = array('content' => ossn_view('components/chatroom/index'));
    $content = ossn_set_page_layout('newsfeed', $contents);
    echo ossn_view_page($title, $content);
}
コード例 #3
0
/**
 * Invite page handler
 * 
 * @note Please don't call this function directly in your code.
 *
 * @return mixed
 * @access private
 */
function ossn_invite_pagehandler()
{
    if (!ossn_isLoggedin()) {
        ossn_error_page();
    }
    $title = ossn_print('com:ossn:invite:friends');
    $contents['content'] = ossn_view('components/OssnInvite/pages/invite');
    $content = ossn_set_page_layout('newsfeed', $contents);
    echo ossn_view_page($title, $content);
}
コード例 #4
0
ファイル: ossn_com.php プロジェクト: alexmwiti/componets
function severpages($pages)
{
    if (!ossn_isLoggedin()) {
        ossn_error_page();
    }
    $title = ossn_print('com:ossn:severload');
    //give a exact path to file <components/serverpages/pages/serverload>
    $contents['content'] = ossn_view('components/serverpages/pages/severload');
    $content = ossn_set_page_layout('contents', $contents);
    echo ossn_view_page($title, $content);
}
コード例 #5
0
function ossn_site_pages($pages)
{
    $page = $pages[0];
    if (empty($page)) {
        redirect(REF);
    }
    $OssnSitePages = new OssnSitePages();
    switch ($page) {
        case 'about':
            $OssnSitePages->pagename = 'about';
            $OssnSitePages = $OssnSitePages->getPage();
            if (isset($OssnSitePages->description)) {
                $params['contents'] = html_entity_decode(html_entity_decode($OssnSitePages->description));
            }
            $params['title'] = ossn_print('site:about');
            $title = $params['title'];
            $contents = array('content' => ossn_view('components/OssnSitePages/pages/page', $params));
            $content = ossn_set_page_layout('contents', $contents);
            echo ossn_view_page($title, $content);
            break;
        case 'terms':
            $OssnSitePages->pagename = 'terms';
            $OssnSitePages = $OssnSitePages->getPage();
            if (isset($OssnSitePages->description)) {
                $params['contents'] = html_entity_decode(html_entity_decode($OssnSitePages->description));
            }
            $params['title'] = ossn_print('site:terms');
            $title = $params['title'];
            $contents = array('content' => ossn_view('components/OssnSitePages/pages/page', $params));
            $content = ossn_set_page_layout('contents', $contents);
            echo ossn_view_page($title, $content);
            break;
        case 'privacy':
            $OssnSitePages->pagename = 'privacy';
            $OssnSitePages = $OssnSitePages->getPage();
            if (isset($OssnSitePages->description)) {
                $params['contents'] = html_entity_decode(html_entity_decode($OssnSitePages->description));
            }
            $params['title'] = ossn_print('site:privacy');
            $title = $params['title'];
            $contents = array('content' => ossn_view('components/OssnSitePages/pages/page', $params));
            $content = ossn_set_page_layout('contents', $contents);
            echo ossn_view_page($title, $content);
            break;
        default:
            ossn_error_page();
            break;
    }
}
コード例 #6
0
function ossn_messages_page($pages)
{
    if (!ossn_isLoggedin()) {
        ossn_error_page();
    }
    $OssnMessages = new OssnMessages();
    $page = $pages[0];
    if (empty($page)) {
        $page = 'messages';
    }
    switch ($page) {
        case 'message':
            $username = $pages[1];
            if (!empty($username)) {
                $user = ossn_user_by_username($username);
                if (empty($user->guid)) {
                    ossn_error_page();
                }
                $title = ossn_print('ossn:message:between', array($user->fullname));
                $OssnMessages->markViewed($user->guid, ossn_loggedin_user()->guid);
                $params['data'] = $OssnMessages->get(ossn_loggedin_user()->guid, $user->guid);
                $params['user'] = $user;
                $params['recent'] = $OssnMessages->recentChat(ossn_loggedin_user()->guid);
                $contents = array('content' => ossn_plugin_view('messages/pages/view', $params));
                $content = ossn_set_page_layout('media', $contents);
                echo ossn_view_page($title, $content);
            } else {
                ossn_error_page();
            }
            break;
        case 'all':
            $params['recent'] = $OssnMessages->recentChat(ossn_loggedin_user()->guid);
            $active = $params['recent'][0];
            if (isset($active->message_to) && $active->message_to == ossn_loggedin_user()->guid) {
                $getuser = $active->message_from;
            }
            if (isset($active->message_from) && $active->message_from == ossn_loggedin_user()->guid) {
                $getuser = $active->message_to;
            }
            if (isset($getuser)) {
                $user = ossn_user_by_guid($getuser);
                $OssnMessages->markViewed($getuser, ossn_loggedin_user()->guid);
                $params['data'] = $OssnMessages->get(ossn_loggedin_user()->guid, $getuser);
                $params['user'] = $user;
            }
            $contents = array('content' => ossn_plugin_view('messages/pages/messages', $params));
            if (!isset($getuser)) {
                $contents = array('content' => ossn_plugin_view('messages/pages/messages-none'));
            }
            $title = ossn_print('messages');
            $content = ossn_set_page_layout('media', $contents);
            echo ossn_view_page($title, $content);
            break;
        case 'getnew':
            $username = $pages[1];
            $guid = ossn_user_by_username($username)->guid;
            $messages = $OssnMessages->getNew($guid, ossn_loggedin_user()->guid);
            if ($messages) {
                foreach ($messages as $message) {
                    $user = ossn_user_by_guid($message->message_from);
                    $message = $message->message;
                    $params['user'] = $user;
                    $params['message'] = $message;
                    echo ossn_plugin_view('messages/templates/message-send', $params);
                }
                $OssnMessages->markViewed($guid, ossn_loggedin_user()->guid);
                echo '<script>Ossn.playSound();</script>';
            }
            break;
        case 'getrecent':
            $params['recent'] = $OssnMessages->recentChat(ossn_loggedin_user()->guid);
            echo ossn_plugin_view('messages/templates/message-with', $params);
            break;
        default:
            ossn_error_page();
            break;
    }
}
コード例 #7
0
/**
 * OssnWall post page handlers 
 * 
 * @param array $pages List of pages
 *
 * @return false|mixed data
 * @access private
 */
function ossn_post_page($pages)
{
    $page = $pages[0];
    if (empty($page)) {
        return false;
    }
    switch ($page) {
        case 'view':
            $title = ossn_print('post:view');
            $wall = new OssnWall();
            $post = $pages[1];
            $post = $wall->GetPost($post);
            if (empty($post->guid) || empty($pages[1])) {
                ossn_error_page();
            }
            $params['post'] = $post;
            $contents = array('content' => ossn_plugin_view('wall/pages/view', $params));
            $content = ossn_set_page_layout('newsfeed', $contents);
            echo ossn_view_page($title, $content);
            break;
        case 'photo':
            if (isset($pages[1]) && isset($pages[2])) {
                $image = ossn_get_userdata("object/{$pages[1]}/ossnwall/images/{$pages[2]}");
                header('Content-Type: image/jpeg');
                echo file_get_contents($image);
            }
            break;
        case 'privacy':
            if (ossn_is_xhr()) {
                $params = array('title' => ossn_print('privacy'), 'contents' => ossn_plugin_view('wall/privacy'), 'callback' => '#ossn-wall-privacy');
                echo ossn_plugin_view('output/ossnbox', $params);
            }
            break;
        case 'refresh_home':
            echo ossn_plugin_view('wall/siteactivity');
            break;
        default:
            ossn_error_page();
            break;
    }
}
コード例 #8
0
/**
 * Register a page handler for administrator login;
 * @pages:
 *       administrator/login,
 * @return mixeddata
 */
function ossn_administrator_login_pagehandler($pages)
{
    $page = $pages[0];
    if (empty($page)) {
        $page = 'login';
    }
    switch ($page) {
        case 'login':
            $title = 'Login';
            $contents['contents'] = ossn_view("pages/administrator/contents/login");
            $contents['title'] = $title;
            $content = ossn_set_page_layout('administrator/login', $contents);
            echo ossn_view_page($title, $content, 'administrator');
            break;
        default:
            echo 403;
            break;
    }
}
コード例 #9
0
/**
 * Register basic pages
 * @pages:
 *       home,
 *    login,
 *       registered
 *
 * @return mixed contents
 */
function ossn_user_pagehandler($home, $handler)
{
    switch ($handler) {
        case 'home':
            if (!ossn_isLoggedin()) {
                ossn_error_page();
            }
            $title = ossn_print('news:feed');
            if (com_is_active('OssnWall')) {
                $contents['content'] = ossn_plugin_view('wall/pages/wall');
            }
            $content = ossn_set_page_layout('newsfeed', $contents);
            echo ossn_view_page($title, $content);
            break;
        case 'resetlogin':
            if (ossn_isLoggedin()) {
                redirect('home');
            }
            $user = input('user');
            $code = input('c');
            $contents['content'] = ossn_plugin_view('pages/contents/user/resetlogin');
            if (!empty($user) && !empty($code)) {
                $contents['content'] = ossn_plugin_view('pages/contents/user/resetcode');
            }
            $title = ossn_print('reset:login');
            $content = ossn_set_page_layout('startup', $contents);
            echo ossn_view_page($title, $content);
            break;
        case 'login':
            if (ossn_isLoggedin()) {
                redirect('home');
            }
            $title = ossn_print('site:login');
            $contents['content'] = ossn_plugin_view('pages/contents/user/login');
            $content = ossn_set_page_layout('startup', $contents);
            echo ossn_view_page($title, $content);
            break;
        case 'registered':
            if (ossn_isLoggedin()) {
                redirect('home');
            }
            $title = ossn_print('account:registered');
            $contents['content'] = ossn_plugin_view('pages/contents/user/registered');
            $content = ossn_set_page_layout('startup', $contents);
            echo ossn_view_page($title, $content);
            break;
        default:
            ossn_error_page();
            break;
    }
}
コード例 #10
0
ファイル: ossn_com.php プロジェクト: tricotrin/OptionTrips
/**
 * Viatges "handler" 
 * @pages:
 *       view,
 *       add
 *       
 *
 * @return diferent contents
 */
function trip_page_handler($trip)
{
    $page = $trip[0];
    if (empty($page)) {
        ossn_error_page();
        //Mostra 404
    }
    // var_dump($trip);
    switch ($page) {
        //Vista viatge (Accés públic no existeix restricció de visualització)
        case 'view':
            $view = new OptionTrips();
            $viewAlbum = new OssnAlbums();
            $album = $viewAlbum->GetAlbum(19);
            //Agafa id del viatge
            $infoTrip = $view->GetTrip($trip[1]);
            //Agafa id del viatge
            $infoDays = $view->GetTripDays($trip[1]);
            // var_dump($image);
            //$photo['entity'] = $image;
            $trip['info'] = $infoTrip;
            $trip['day'] = $infoDays;
            $trip['album'] = $album;
            //redirect user to home page if trip is empty
            if (empty($infoTrip)) {
                redirect();
            }
            //Missing "back" button to trips
            $owner = ossn_user_by_guid($infoTrip->guid);
            $back = array('text' => ossn_print('back'), 'href' => ossn_site_url("u/{$owner->username}/trips"), 'class' => 'button-grey');
            $control = ossn_plugin_view('output/url', $back);
            $contents = array('title' => ossn_print('trip:details'), 'content' => ossn_plugin_view('trips/pages/trip/view', $trip), 'controls' => $control, 'module_width' => '850px');
            //inclou page layout
            $module['content'] = ossn_set_page_layout('module', $contents);
            //Inclou modul amb els botons d'accions
            $content = ossn_set_page_layout('contents', $module);
            echo ossn_view_page($title, $content);
            break;
            //Afegir viatge
        //Afegir viatge
        case 'add':
            //Missing "back" button to trips
            $owner = ossn_loggedin_user()->username;
            // var_dump($owner);
            $back = array('text' => ossn_print('back'), 'href' => ossn_site_url("u/{$owner}/trips"), 'class' => 'button-grey');
            $control = ossn_plugin_view('output/url', $back);
            $contents = array('title' => ossn_print('add:trip'), 'content' => ossn_plugin_view('trips/pages/trip/add'), 'controls' => $control, 'module_width' => '850px');
            //inclou page layout
            $module['content'] = ossn_set_page_layout('module', $contents);
            //Inclou modul amb els botons d'accions
            $content = ossn_set_page_layout('contents', $module);
            echo ossn_view_page($title, $content);
            // echo ossn_plugin_view('output/url', array(
            // 		'title' => ossn_print('add:trip'),
            // 		'contents' => ossn_plugin_view('trips/pages/trip/add'),
            // 		'callback' => '#ossn-trip-submit'
            // ));
            break;
        case 'addPhoto':
            //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('trips/pages/trip/addPhoto'), 'callback' => '#photos-submit'));
            break;
        default:
            ossn_error_page();
            //Mostra 404
            break;
    }
}
コード例 #11
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
 */
$title = ossn_print('site:index');
$content = ossn_set_page_layout('startup', array('content' => ossn_view('pages/contents/index')));
echo ossn_view_page($title, $content);
コード例 #12
0
ファイル: ossn_com.php プロジェクト: emnaborgi/RS
/**
 * Group page handler
 * This page also contain subpages like group/<guid>/members
 *
 * Pages:
 *      group/<guid>
 *      group/<guid>/<subpage>
 * Subpage need to be register seperatly.
 *
 * @return mixdata;
 * @access private
 */
function ossn_group_page($pages)
{
    if (empty($pages[0])) {
        ossn_error_page();
    }
    if (!empty($pages[0]) && !empty($pages[0])) {
        if (isset($pages[1])) {
            $params['subpage'] = $pages[1];
        } else {
            $params['subpage'] = '';
        }
        if (!ossn_is_group_subapge($params['subpage']) && !empty($params['subpage'])) {
            return false;
        }
        $group = ossn_get_group_by_guid($pages[0]);
        if (empty($group->guid)) {
            ossn_error_page();
        }
        ossn_set_page_owner_guid($group->guid);
        ossn_trigger_callback('page', 'load:group');
        $params['group'] = $group;
        $title = $group->title;
        $view = ossn_plugin_view('groups/pages/profile', $params);
        $contents['content'] = ossn_group_layout($view);
        $content = ossn_set_page_layout('contents', $contents);
        echo ossn_view_page($title, $content);
    }
}
コード例 #13
0
/**
 * Notifications page
 *
 * @param (array) $pages Array containg pages
 *
 * @return mixed data;
 * @access public
 */
function ossn_notifications_page($pages)
{
    $page = $pages[0];
    if (empty($page)) {
        return false;
    }
    switch ($page) {
        case 'all':
            $title = 'Notifications';
            $contents = array('content' => ossn_view('components/OssnNotifications/pages/all'));
            $content = ossn_set_page_layout('media', $contents);
            echo ossn_view_page($title, $content);
            break;
        default:
            ossn_error_page();
            break;
    }
}
コード例 #14
0
/**
 * Ossn Albums page handler
 * @pages:
 *       getphoto,
 *    view,
 *       profile,
 *       add
 *
 * @return false|null contents
 */
function ossn_album_page_handler($album)
{
    $page = $album[0];
    if (empty($page)) {
        return false;
    }
    switch ($page) {
        case 'getphoto':
            $guid = $album[1];
            $picture = $album[2];
            $size = input('size');
            // get image size
            if (empty($size)) {
                $datadir = ossn_get_userdata("object/{$guid}/album/photos/{$picture}");
            } else {
                $datadir = ossn_get_userdata("object/{$guid}/album/photos/{$size}_{$picture}");
            }
            //get image type
            $type = input('type');
            if ($type == '1') {
                if (empty($size)) {
                    $datadir = ossn_get_userdata("user/{$guid}/profile/photo/{$picture}");
                } else {
                    $datadir = ossn_get_userdata("user/{$guid}/profile/photo/{$size}_{$picture}");
                }
            }
            $image = file_get_contents($datadir);
            //get image file else show error page
            if (is_file($datadir)) {
                header('Content-Type: image/jpeg');
                echo $image;
            } else {
                ossn_error_page();
            }
            break;
        case 'getcover':
            $guid = $album[1];
            $picture = $album[2];
            $type = input('type');
            // get image size
            $datadir = ossn_get_userdata("user/{$guid}/profile/cover/{$picture}");
            if (empty($type)) {
                $image = file_get_contents($datadir);
            } elseif ($type == 1) {
                $image = ossn_resize_image($datadir, 170, 170, true);
            }
            //get image file else show error page
            if (is_file($datadir)) {
                header('Content-Type: image/jpeg');
                echo $image;
            } else {
                ossn_error_page();
            }
            break;
        case 'view':
            if (isset($album[1])) {
                $title = ossn_print('photos');
                $user['album'] = $album[1];
                $albumget = ossn_albums();
                $owner = $albumget->GetAlbum($album[1])->album;
                if (empty($owner)) {
                    ossn_error_page();
                }
                //throw 404 page if there is no album access
                if ($owner->access == 3) {
                    if (!ossn_validate_access_friends($owner->owner_guid)) {
                        ossn_error_page();
                    }
                }
                //shows add photos if owner is loggedin user
                if (ossn_loggedin_user()->guid == $owner->owner_guid) {
                    $addphotos = array('text' => ossn_print('add:photos'), 'href' => 'javascript::;', 'id' => 'ossn-add-photos', 'data-url' => '?album=' . $album[1], 'class' => 'button-grey');
                    $control = ossn_view('system/templates/output/url', $addphotos);
                } else {
                    $control = false;
                }
                //set photos in module
                $contents = array('title' => ossn_print('photos'), 'content' => ossn_view('components/OssnPhotos/pages/albums', $user), 'controls' => $control, 'module_width' => '850px');
                //set page layout
                $module['content'] = ossn_set_page_layout('module', $contents);
                $content = ossn_set_page_layout('contents', $module);
                echo ossn_view_page($title, $content);
            }
            break;
        case 'profile':
            if (isset($album[1])) {
                $title = ossn_print('profile:photos');
                $user['user'] = ossn_user_by_guid($album[1]);
                if (empty($user['user']->guid)) {
                    ossn_error_page();
                }
                //view profile photos in module layout
                $contents = array('title' => ossn_print('photos'), 'content' => ossn_view('components/OssnPhotos/pages/profile/photos/all', $user), 'controls' => false, 'module_width' => '850px');
                $module['content'] = ossn_set_page_layout('module', $contents);
                //set page layout
                $content = ossn_set_page_layout('contents', $module);
                echo ossn_view_page($title, $content);
            }
            break;
        case 'covers':
            if (isset($album[2]) && $album[1] == 'profile') {
                $title = ossn_print('profile:covers');
                $user['user'] = ossn_user_by_guid($album[2]);
                if (empty($user['user']->guid)) {
                    ossn_error_page();
                }
                //view profile photos in module layout
                $contents = array('title' => ossn_print('covers'), 'content' => ossn_view('components/OssnPhotos/pages/profile/covers/all', $user), 'controls' => false, 'module_width' => '850px');
                $module['content'] = ossn_set_page_layout('module', $contents);
                //set page layout
                $content = ossn_set_page_layout('contents', $module);
                echo ossn_view_page($title, $content);
            }
            break;
        case 'add':
            //add photos (ajax)
            echo ossn_view('system/templates/output/ossnbox', array('title' => ossn_print('add:album'), 'contents' => ossn_view('components/OssnPhotos/pages/album/add'), 'success_id' => 'aga', 'callback' => '#ossn-album-submit'));
            break;
        default:
            ossn_error_page();
            break;
    }
}
コード例 #15
0
/**
 * Ossn Albums page handler
 * @pages:
 *       getphoto,
 *    view,
 *       profile,
 *       add
 *
 * @return false|null contents
 */
function ossn_album_page_handler($album)
{
    $page = $album[0];
    if (empty($page)) {
        return false;
    }
    switch ($page) {
        case 'getphoto':
            $guid = $album[1];
            $picture = $album[2];
            $size = input('size');
            $name = str_replace(array('.jpg', '.jpeg', 'gif'), '', $picture);
            $etag = $size . $name . $guid;
            if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == "\"{$etag}\"") {
                header("HTTP/1.1 304 Not Modified");
                exit;
            }
            // get image size
            if (empty($size)) {
                $datadir = ossn_get_userdata("object/{$guid}/album/photos/{$picture}");
            } else {
                $datadir = ossn_get_userdata("object/{$guid}/album/photos/{$size}_{$picture}");
            }
            //get image type
            $type = input('type');
            if ($type == '1') {
                if (empty($size)) {
                    $datadir = ossn_get_userdata("user/{$guid}/profile/photo/{$picture}");
                } else {
                    $datadir = ossn_get_userdata("user/{$guid}/profile/photo/{$size}_{$picture}");
                }
            }
            if (is_file($datadir)) {
                $filesize = filesize($datadir);
                header("Content-type: image/jpeg");
                header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', strtotime("+6 months")), true);
                header("Pragma: public");
                header("Cache-Control: public");
                header("Content-Length: {$filesize}");
                header("ETag: \"{$etag}\"");
                readfile($datadir);
                return;
            } else {
                ossn_error_page();
            }
            break;
        case 'getcover':
            $guid = $album[1];
            $picture = $album[2];
            $type = input('type');
            $name = str_replace(array('.jpg', '.jpeg', 'gif'), '', $picture);
            $etag = $size . $name . $guid;
            if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == "\"{$etag}\"") {
                header("HTTP/1.1 304 Not Modified");
                exit;
            }
            // get image size
            $datadir = ossn_get_userdata("user/{$guid}/profile/cover/{$picture}");
            if (empty($type)) {
                $image = file_get_contents($datadir);
            } elseif ($type == 1) {
                $image = ossn_resize_image($datadir, 170, 170, true);
            }
            //get image file else show error page
            if (is_file($datadir)) {
                $filesize = filesize($datadir);
                header("Content-type: image/jpeg");
                header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', strtotime("+6 months")), true);
                header("Pragma: public");
                header("Cache-Control: public");
                header("Content-Length: {$filesize}");
                header("ETag: \"{$etag}\"");
                readfile($datadir);
                return;
            } else {
                ossn_error_page();
            }
            break;
        case 'view':
            if (isset($album[1])) {
                $title = ossn_print('photos');
                $user['album'] = $album[1];
                $albumget = ossn_albums();
                $owner = $albumget->GetAlbum($album[1])->album;
                if (empty($owner)) {
                    ossn_error_page();
                }
                //throw 404 page if there is no album access
                if ($owner->access == 3) {
                    if (!ossn_validate_access_friends($owner->owner_guid)) {
                        ossn_error_page();
                    }
                }
                //shows add photos if owner is loggedin user
                if (ossn_loggedin_user()->guid == $owner->owner_guid) {
                    $addphotos = array('text' => ossn_print('add:photos'), 'href' => 'javascript::void(0);', 'id' => 'ossn-add-photos', 'data-url' => '?album=' . $album[1], 'class' => 'button-grey');
                    $delete_action = ossn_site_url("action/ossn/album/delete?guid={$album[1]}", true);
                    $delete_album = array('text' => ossn_print('delete:album'), 'href' => $delete_action, 'class' => 'button-grey');
                    $control = ossn_plugin_view('output/url', $addphotos);
                    $control .= ossn_plugin_view('output/url', $delete_album);
                } else {
                    $control = false;
                }
                //set photos in module
                $contents = array('title' => ossn_print('photos'), 'content' => ossn_plugin_view('photos/pages/albums', $user), 'controls' => $control, 'module_width' => '850px');
                //set page layout
                $module['content'] = ossn_set_page_layout('module', $contents);
                $content = ossn_set_page_layout('contents', $module);
                echo ossn_view_page($title, $content);
            }
            break;
        case 'profile':
            if (isset($album[1])) {
                $title = ossn_print('profile:photos');
                $user['user'] = ossn_user_by_guid($album[1]);
                if (empty($user['user']->guid)) {
                    ossn_error_page();
                }
                //view profile photos in module layout
                $contents = array('title' => ossn_print('photos'), 'content' => ossn_plugin_view('photos/pages/profile/photos/all', $user), 'controls' => false, 'module_width' => '850px');
                $module['content'] = ossn_set_page_layout('module', $contents);
                //set page layout
                $content = ossn_set_page_layout('contents', $module);
                echo ossn_view_page($title, $content);
            }
            break;
        case 'covers':
            if (isset($album[2]) && $album[1] == 'profile') {
                $title = ossn_print('profile:covers');
                $user['user'] = ossn_user_by_guid($album[2]);
                if (empty($user['user']->guid)) {
                    ossn_error_page();
                }
                //view profile photos in module layout
                $contents = array('title' => ossn_print('covers'), 'content' => ossn_plugin_view('photos/pages/profile/covers/all', $user), 'controls' => false, 'module_width' => '850px');
                $module['content'] = ossn_set_page_layout('module', $contents);
                //set page layout
                $content = ossn_set_page_layout('contents', $module);
                echo ossn_view_page($title, $content);
            }
            break;
        case 'add':
            //add photos (ajax)
            echo ossn_plugin_view('output/ossnbox', array('title' => ossn_print('add:album'), 'contents' => ossn_plugin_view('photos/pages/album/add'), 'success_id' => 'aga', 'callback' => '#ossn-album-submit'));
            break;
        default:
            ossn_error_page();
            break;
    }
}
コード例 #16
0
ファイル: ossn_com.php プロジェクト: emnaborgi/RS
/**
 * OssnWall post page handlers 
 * 
 * @param array $pages List of pages
 *
 * @return false|mixed data
 * @access private
 */
function ossn_post_page($pages)
{
    $page = $pages[0];
    if (empty($page)) {
        return false;
    }
    switch ($page) {
        case 'view':
            $title = ossn_print('post:view');
            $wall = new OssnWall();
            $post = $pages[1];
            $post = $wall->GetPost($post);
            if (empty($post->guid) || empty($pages[1])) {
                ossn_error_page();
            }
            $params['post'] = $post;
            $contents = array('content' => ossn_plugin_view('wall/pages/view', $params));
            $content = ossn_set_page_layout('newsfeed', $contents);
            echo ossn_view_page($title, $content);
            break;
        case 'photo':
            if (isset($pages[1]) && isset($pages[2])) {
                $name = str_replace(array('.jpg', '.jpeg', 'gif'), '', $pages[2]);
                $etag = $pages[1] . $name;
                if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH']) == "\"{$etag}\"") {
                    header("HTTP/1.1 304 Not Modified");
                    exit;
                }
                $image = ossn_get_userdata("object/{$pages[1]}/ossnwall/images/{$pages[2]}");
                //get image file else show error page
                if (is_file($image)) {
                    //Image cache on wall post #529
                    $filesize = filesize($image);
                    header("Content-type: image/jpeg");
                    header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', strtotime("+6 months")), true);
                    header("Pragma: public");
                    header("Cache-Control: public");
                    header("Content-Length: {$filesize}");
                    header("ETag: \"{$etag}\"");
                    readfile($image);
                    return;
                } else {
                    ossn_error_page();
                }
            }
            break;
        case 'privacy':
            if (ossn_is_xhr()) {
                $params = array('title' => ossn_print('privacy'), 'contents' => ossn_plugin_view('wall/privacy'), 'callback' => '#ossn-wall-privacy');
                echo ossn_plugin_view('output/ossnbox', $params);
            }
            break;
        case 'refresh_home':
            echo ossn_plugin_view('wall/siteactivity');
            break;
        default:
            ossn_error_page();
            break;
    }
}
コード例 #17
0
ファイル: ossn_com.php プロジェクト: nongdanit-nongdanit/ossn
/**
 * Profile page handler
 *
 * @return false|null data;
 */
function profile_page_handler($page)
{
    $user = ossn_user_by_username($page[0]);
    if (empty($user->guid)) {
        ossn_error_page();
    }
    ossn_set_page_owner_guid($user->guid);
    ossn_trigger_callback('page', 'load:profile');
    $params['user'] = $user;
    $params['page'] = $page;
    if (isset($page[1])) {
        $params['subpage'] = $page[1];
    } else {
        $params['subpage'] = '';
    }
    if (!ossn_is_profile_subapge($params['subpage']) && !empty($params['subpage'])) {
        return false;
    }
    $title = $user->fullname;
    $contents['content'] = ossn_plugin_view('profile/pages/profile', $params);
    $content = ossn_set_page_layout('contents', $contents);
    echo ossn_view_page($title, $content);
}
コード例 #18
0
/**
 * Output Ossn Error page
 *
 * @return mix data
 */
function ossn_error_page()
{
    $title = ossn_print('page:error');
    $contents['content'] = ossn_view('pages/contents/error');
    $contents['background'] = false;
    $content = ossn_set_page_layout('contents', $contents);
    $data = ossn_view_page($title, $content);
    echo $data;
    exit;
}
コード例 #19
0
/**
 * Output Ossn Error page
 *
 * @return mix data
 */
function ossn_error_page()
{
    if (ossn_is_xhr()) {
        header("HTTP/1.0 404 Not Found");
    } else {
        $title = ossn_print('page:error');
        $contents['content'] = ossn_plugin_view('pages/contents/error');
        $contents['background'] = false;
        $content = ossn_set_page_layout('contents', $contents);
        $data = ossn_view_page($title, $content);
        echo $data;
    }
    exit;
}
コード例 #20
0
ファイル: ossn.lib.admin.php プロジェクト: emnaborgi/RS
/**
 * Register a page handler for administrator login;
 * @pages:
 *       administrator/login,
 * @return mixeddata
 */
function ossn_administrator_login_pagehandler($pages)
{
    $page = $pages[0];
    if (empty($page)) {
        $page = 'login';
    }
    $logout = input('logout');
    if ($logout == 'true') {
        ossn_trigger_message(ossn_print('logged:out'));
        redirect('administrator');
    }
    switch ($page) {
        case 'login':
            $title = ossn_print('admin:login');
            $contents['contents'] = ossn_plugin_view("pages/administrator/contents/login");
            $contents['title'] = $title;
            $content = ossn_set_page_layout('administrator/login', $contents);
            echo ossn_view_page($title, $content, 'administrator');
            break;
        default:
            ossn_error_page();
            break;
    }
}