当前位置: 首页>>代码示例>>PHP>>正文


PHP Room::open方法代码示例

本文整理汇总了PHP中Room::open方法的典型用法代码示例。如果您正苦于以下问题:PHP Room::open方法的具体用法?PHP Room::open怎么用?PHP Room::open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Room的用法示例。


在下文中一共展示了Room::open方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: room

function room()
{
    global $sr_root;
    global $sr_channel_server_uri;
    global $sr_room_ui_title;
    global $sr_join_anonymous;
    global $sr_join_non_authorized;
    global $sr_default_chat_name;
    $db = sr_pdo();
    $browser = room_get_browser();
    if ($browser['name'] != 'Mozilla Firefox' && $browser['name'] != 'Google Chrome') {
        sr_redirect('/d/room/message/browser/');
    }
    if (isset($_GET['name']) && strlen($_GET['name']) > 0) {
        try {
            $context = array();
            // check if the room with the specified name exists
            $stmt = $db->prepare('SELECT * FROM room WHERE name = :name');
            $stmt->bindParam(':name', $_GET['name']);
            $stmt->setFetchMode(PDO::FETCH_CLASS, 'Room');
            $stmt->execute();
            $room = $stmt->fetch();
            if ($room === False) {
                // Room doesn't exist. Create a room using the requested name
                $room = new Room();
                $room->name = $_GET['name'];
                $room->title = '';
                $room->description = '';
                $room->password = '';
                $room->is_open = 1;
                $room->open($db);
            } else {
                $room->title = stripslashes($room->title);
                $room->description = stripslashes($room->description);
            }
        } catch (PDOException $e) {
            sr_response_error(500);
        }
        $context['sunrise_main'] = $sr_root;
        $context['channel_server'] = $sr_channel_server_uri;
        $context['room'] = $room;
        $context['room_link'] = sr_current_url();
        $context['room_api'] = $sr_root;
        $context['room_ui_title'] = $sr_room_ui_title;
        //IF he is registered user
        if (sr_is_signed_in()) {
            //IF server allow non-authorized user to join
            if ($sr_join_non_authorized) {
                $context['user_id'] = $_SESSION['user_id'];
                $context['is_registered_user'] = 'true';
                //IF server allow only authorized user to join
            } else {
                //IF he is authorized user
                if (sr_is_authorized()) {
                    $context['user_id'] = $_SESSION['user_id'];
                    $context['is_registered_user'] = 'true';
                    //IF he is non-authorized user
                } else {
                    sr_redirect('/d/room/message/auth/');
                }
            }
            //IF he is anonymous user
        } else {
            //IF server allow anonymous user to join
            if ($sr_join_anonymous) {
                $context['user_id'] = 0;
                $context['is_registered_user'] = 'false';
                //IF server not allow anonymous user to join
            } else {
                $_SESSION['next_page'] = 1;
                $_SESSION['room_name'] = $_GET['name'];
                $context['info'] = 'Only registered users can join the room.';
                sr_response('views/main/signin.php', $context);
            }
        }
        $context['user_name'] = $_SESSION['user_name'];
        $context['chat_name'] = $_SESSION['chat_name'];
        if ($_SESSION['chat_name']) {
            $context['chat_name'] = $_SESSION['chat_name'];
        } else {
            if ($_SESSION['user_name']) {
                $context['chat_name'] = $_SESSION['user_name'];
                $_SESSION['chat_name'] = $_SESSION['user_name'];
            } else {
                $context['chat_name'] = $sr_default_chat_name;
                $_SESSION['chat_name'] = $sr_default_chat_name;
            }
        }
        if ($room->is_open == 1) {
            sr_response('views/room/room.php', $context);
            //IF locked room
        } else {
            if (isset($_SESSION['is_checked_password']) && $_SESSION['is_checked_password'] == $_SESSION['room_name']) {
                unset($_SESSION['is_checked_password']);
                unset($_SESSION['room_name']);
                sr_response('views/room/room.php', $context);
            } else {
                $_SESSION['room_name'] = $_GET['name'];
                sr_redirect('/d/room/message/pswd/');
            }
//.........这里部分代码省略.........
开发者ID:rakesh-mohanta,项目名称:Sunrise,代码行数:101,代码来源:room.php

示例2: Room

 function handler_group_ajax_open($page, $gid, $rid, $state = null)
 {
     S::assert_xsrf_token();
     $room = new Room($rid);
     $group = Group::fromId($gid, false);
     if ($group) {
         $group->select(GroupSelect::premises());
         if ($group->isRoomMaster()) {
             $room->open($state);
         }
     }
     return PL_JSON;
 }
开发者ID:netixx,项目名称:frankiz,代码行数:13,代码来源:groups.php


注:本文中的Room::open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。