Exemplo n.º 1
0
<?php

// (c) Copyright 2002-2013 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id: mobile.php 52907 2014-10-16 16:05:30Z jonnybradley $
//this script may only be included - so its better to die if called directly.
$access->check_script($_SERVER['SCRIPT_NAME'], basename(__FILE__));
if (!isset($_REQUEST['mobile_mode']) || $_REQUEST['mobile_mode'] === 'y') {
    require_once 'vendor_extra/mobileesp/mdetect.php';
    $uagent_info = new uagent_info();
    $supported_device = $uagent_info->DetectIphoneOrIpod() || $uagent_info->DetectIpad() || $uagent_info->DetectAndroid() || $uagent_info->DetectBlackBerry() || $uagent_info->DetectOperaMobile() || $uagent_info->DetectPalmWebOS();
    if (!getCookie('mobile_mode') && $supported_device || getCookie('mobile_mode') === 'y') {
        // supported by jquery.mobile
        if (!is_array($prefs['mobile_perspectives'])) {
            $prefs['mobile_perspectives'] = unserialize($prefs['mobile_perspectives']);
        }
        if (count($prefs['mobile_perspectives']) > 0) {
            $persp = $prefs['mobile_perspectives'][0];
            if (Perms::get(array('type' => 'perspective', 'object' => $persp))->perspective_view) {
                $prefs['mobile_mode'] = 'y';
                // hard-wire a few incompatible prefs shut to speed development
                $prefs['feature_jquery_ui'] = 'n';
                $prefs['feature_jquery_reflection'] = 'n';
                $prefs['feature_fullscreen'] = 'n';
                $prefs['feature_syntax_highlighter'] = 'n';
                $prefs['feature_layoutshadows'] = 'n';
                $prefs['feature_wysiwyg'] = 'n';
                $prefs['themegenerator_feature'] = 'n';
                $prefs['ajax_autosave'] = 'n';