function __construct()
 {
     parent::__construct();
     $this->load->model('Applications_model');
     $this->load->library('User_Agent');
     $this->load->library('form_validation');
     $this->load->helper('common');
     $this->load->helper('pdf_helper');
     $this->load->helper('csv_helper');
     $this->load->config('messages');
     $this->data['welcome'] = $this;
     $this->allowedImageExt = array('gif', 'png', 'jpeg', 'jpg');
     //$this->load->library('User_Agent');//--regex class to get user agent --//
     //-- get browser http_user_agent info in array --//
     //   $this->result = get_browser(null, true);
     $this->result = User_Agent::getinfo();
     //--regex class to get user agent --//
     //---------------------//
     $this->load->library('session');
     $per = $this->check_per();
     if (!$per) {
         redirect(base_url() . 'layout/permission_error');
     }
     $s = $this->session->all_userdata();
     $this->user = $s[0]->username;
     $this->uid = $s[0]->id;
     $this->role_id = $s[0]->role_id;
 }
Exemplo n.º 2
0
 /**
  * Accessor for the user agent string.
  *
  * @return string
  */
 public static function get()
 {
     if (self::$_agent === null) {
         self::$_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : false;
     }
     return self::$_agent;
 }
 function __construct()
 {
     parent::__construct();
     $this->load->model('/api/Video_model');
     $this->load->model('/ads/Ads_analytics_model');
     $this->load->library('User_Agent');
     $this->load->helper('common');
     $this->load->helper('pdf_helper');
     $this->load->helper('csv_helper');
     $this->load->config('messages');
     $per = $this->check_per();
     if (!$per) {
         redirect(base_url() . 'layout/permission_error');
     }
     $this->data['welcome'] = $this;
     //$this->load->library('User_Agent');//--regex class to get user agent --//
     //-- get browser http_user_agent info in array --//
     //   $this->result = get_browser(null, true);
     $this->result = User_Agent::getinfo();
     //--regex class to get user agent --//
     //---------------------//
     $this->load->library('session');
     $s = $this->session->all_userdata();
     $this->user = $s[0]->username;
     $this->uid = $s[0]->id;
     $this->role_id = $s[0]->role_id;
 }
Exemplo n.º 4
0
 function __construct()
 {
     parent::__construct();
     $this->load->helper('url');
     $this->load->model('ads/Ads_model');
     $this->load->model('/analytics/Analytics_model');
     $this->load->library('User_Agent');
     $this->useragent = User_Agent::getinfo();
     //--regex class to get user agent --//
 }
Exemplo n.º 5
0
 /**
  * Returns the height of the browser in the following order: (1) from a
  * cookie set by mwf.browser, (2) from the height that WURFL knows of the
  * device, or (3) the default height.
  *
  * @return int
  */
 public static function height()
 {
     if (self::has_cookie()) {
         return $_COOKIE[Config::get('global', 'cookie_prefix') . 'bh'];
     } else {
         if (($resolution_height = User_Agent::get_capability('resolution_height')) >= 120) {
             return (int) $resolution_height;
         }
     }
     return self::$_default_height;
 }
Exemplo n.º 6
0
    public function getContent()
    {
        global $sql;
        // $kio->disableRegion('left');
        if (u1 || LOGGED) {
            // TODO: Zamiast zapytania dla własnego konta dać User::toArray()
            $profile = $sql->query('
				SELECT u.*
				FROM ' . DB_PREFIX . 'users u
				WHERE u.id = ' . (ctype_digit(u1) ? u1 : UID))->fetch();
        }
        if ($profile) {
            Kio::addTitle(t('Users'));
            Kio::addBreadcrumb(t('Users'), 'users');
            Kio::addTitle($profile['nickname']);
            Kio::addBreadcrumb($profile['nickname'], 'profile/' . u1 . '/' . clean_url($profile['nickname']));
            Kio::setDescription(t('%nickname's profile', array('%nickname' => $profile['nickname'])) . ($profile['title'] ? ' - ' . $profile['title'] : ''));
            Kio::addTabs(array(t('Edit profile') => 'edit_profile/' . u1));
            if ($profile['birthdate']) {
                $profile['bd'] = $profile['birthdate'] ? explode('-', $profile['birthdate']) : '';
                // DD Month YYYY (Remaining days to next birthday)
                $profile['birthdate'] = $profile['bd'][2] . ' ' . Kio::$months[$profile['bd'][1]] . ' ' . $profile['bd'][0] . ' (' . day_diff(mktime(0, 0, 0, $profile['bd'][1], $profile['bd'][2] + 1, date('y')), t('%d days remaining')) . ')';
                $profile['age'] = get_age($profile['bd'][2], $profile['bd'][1], $profile['bd'][0]);
                if (Plugin::exists('zodiac')) {
                    require_once ROOT . 'plugins/zodiac/zodiac.plugin.php';
                    $profile['zodiac'] = Zodiac::get($profile['bd'][2], $profile['bd'][1]);
                }
            }
            if ($profile['http_agent'] && Plugin::exists('user_agent')) {
                require_once ROOT . 'plugins/user_agent/user_agent.plugin.php';
                $profile['os'] = User_Agent::getOS($profile['http_agent']);
                $profile['browser'] = User_Agent::getBrowser($profile['http_agent']);
            }
            $group = Kio::getGroup($profile['group_id']);
            $profile['group'] = $group['name'] ? $group['inline'] ? sprintf($group['inline'], $group['name']) : $group['name'] : '';
            if ($profile['gender']) {
                $profile['gender'] = $profile['gender'] == 1 ? t('Male') : t('Female');
            }
            try {
                // TODO: Zrobić modyfikator dla funkcji o wielu parametrach (teraz jest tylko jeden możliwy)
                $tpl = new PHPTAL('modules/profile/profile.tpl.html');
                $tpl->profile = $profile;
                return $tpl->execute();
            } catch (Exception $e) {
                return template_error($e);
            }
        } else {
            return not_found(t('Selected user doesn't exists.'), array(t('This person was deleted from database.'), t('Entered URL is invalid.')));
        }
    }
Exemplo n.º 7
0
 public static function import_file($file, $localpath = null)
 {
     if (in_array($file, self::instance()->_imp)) {
         return;
     }
     if (!($f = @fopen($file, "r"))) {
         return;
     }
     fclose($f);
     if (User_Agent::has_capability('ajax_manipulate_dom') || User_Agent::is_preview()) {
         echo 'mwf.util.importJS(\'' . $file . '\');';
     } elseif ($localpath !== null && file_exists($localpath)) {
         include $localpath;
     } else {
         return;
     }
     self::instance()->_imp[] = $file;
 }
Exemplo n.º 8
0
 function __construct()
 {
     parent::__construct();
     $this->load->model('/api/Video_model');
     $this->load->model('ads/Ads_model');
     //  $this->load->model('/analytics/Analytics_model');
     $this->load->library('User_Agent');
     $this->load->library('session');
     $per = $this->check_per();
     if (!$per) {
         redirect(base_url() . 'layout/permission_error');
     }
     //-- get browser http_user_agent info in array --//
     //   $this->result = get_browser(null, true);
     $this->result = User_Agent::getinfo();
     //--regex class to get user agent --//
     // print_r($_SERVER[HTTP_USER_AGENT]);die;
     //---------------------//
     $this->zone_id = '11';
     //-- content provider id -- temporary use --//
 }
Exemplo n.º 9
0
    return $text ? 'true' : 'false';
}
function text2text($text)
{
    return $text ? $text : 'false';
}
function js2bool2text($function)
{
    return '<script type="text/javascript">
document.write(' . $function . '() ? "true" : "false");
</script>';
}
function js2text($function)
{
    return '<script type="text/javascript">
var t;
if(t = ' . $function . '())
    document.write(t);
else
    document.write("false");
</script>';
}
echo HTML_Decorator::html_start()->render();
echo Site_Decorator::head()->set_title('MWF About')->render();
echo HTML_Decorator::body_start()->render();
echo Site_Decorator::header()->set_title('MWF Device')->render();
echo Site_Decorator::content_full()->set_padded()->add_header('The Framework')->add_subheader('Server Info')->add_section(label('User Agent') . $_SERVER['HTTP_USER_AGENT'])->add_section(label('IP Address') . $_SERVER['REMOTE_ADDR'])->add_subheader('JS Classification')->add_section(label('mwf.classification.isMobile()') . js2bool2text('mwf.classification.isMobile'))->add_section(label('mwf.classification.isBasic()') . js2bool2text('mwf.classification.isBasic'))->add_section(label('mwf.classification.isStandard()') . js2bool2text('mwf.classification.isStandard'))->add_section(label('mwf.classification.isFull()') . js2bool2text('mwf.classification.isFull'))->add_section(label('mwf.classification.isOverride()') . js2bool2text('mwf.classification.isOverride'))->add_section(label('mwf.classification.isPreview()') . js2bool2text('mwf.classification.isPreview'))->add_subheader('PHP Classification')->add_section(label('Classification::is_mobile()') . bool2text(Classification::is_mobile()))->add_section(label('Classification::is_basic()') . bool2text(Classification::is_basic()))->add_section(label('Classification::is_standard()') . bool2text(Classification::is_standard()))->add_section(label('Classification::is_full()') . bool2text(Classification::is_full()))->add_section(label('Classification::is_override()') . bool2text(Classification::is_override()))->add_section(label('Classification::is_preview()') . bool2text(Classification::is_preview()))->add_subheader('JS User Agent')->add_section(label('mwf.userAgent.getOS()') . js2text('mwf.userAgent.getOS'))->add_section(label('mwf.userAgent.getOSVersion()') . js2text('mwf.userAgent.getOSVersion'))->add_section(label('mwf.userAgent.getBrowser()') . js2text('mwf.userAgent.getBrowser'))->add_section(label('mwf.userAgent.getBrowserEngine()') . js2text('mwf.userAgent.getBrowserEngine'))->add_section(label('mwf.userAgent.getBrowserEngineVersion()') . js2text('mwf.userAgent.getBrowserEngineVersion'))->add_subheader('PHP User Agent')->add_section(label('User_Agent::get_os()') . text2text(User_Agent::get_os()))->add_section(label('User_Agent::get_os_version()') . text2text(User_Agent::get_os_version()))->add_section(label('User_Agent::get_browser()') . text2text(User_Agent::get_browser()))->add_section(label('User_Agent::get_browser_engine()') . text2text(User_Agent::get_browser_engine()))->add_section(label('User_Agent::get_browser_engine_version()') . text2text(User_Agent::get_browser_engine_version()))->add_subheader('JS Screen')->add_section(label('mwf.screen.getHeight()') . js2text('mwf.screen.getHeight'))->add_section(label('mwf.screen.getWidth()') . js2text('mwf.screen.getWidth'))->add_section(label('mwf.screen.getPixelRatio()') . js2text('mwf.screen.getPixelRatio'))->add_subheader('PHP Screen')->add_section(label('Screen::get_height()') . text2text(Screen::get_height()))->add_section(label('Screen::get_width()') . text2text(Screen::get_width()))->add_section(label('Screen::get_pixel_ratio()') . text2text(Screen::get_pixel_ratio()))->render();
echo Site_Decorator::button_full()->set_padded()->add_option(Config::get('global', 'back_to_home_text'), Config::get('global', 'site_url'))->render();
echo Site_Decorator::default_footer()->render();
echo HTML_Decorator::body_end()->render();
echo HTML_Decorator::html_end()->render();
Exemplo n.º 10
0
if (!isset($_GET['no_ga'])) {
    JS::load('utility/analytics.js');
}
if (!isset($_GET['no_favicon']) && !isset($_GET['no_icon'])) {
    JS::load('utility/favicon.js');
}
/**
 * Writes apple-touch-icon[-precomposed] to the DOM.
 */
if (Classification::is_full() && (!Config::get('global', 'appicon_allow_disable_flag') || !isset($_GET['no_appicon']) && !isset($_GET['no_icon']))) {
    JS::load('full/appicon.php');
}
/**
 * Moves the window below the URL bar and fixes Safari viewport on orientation change.
 */
if (User_Agent::get_os() == 'iphone_os') {
    JS::load('iphone/safariurlbar.js');
    JS::load('iphone/orientation.js');
}
/**
 * Include preview_util as part of js.php and import the desktop preview.
 *
 * @uses /assets/js/desktop/preview_util.php
 * @uses /assets/js/desktop/preview.js [import]
 */
if (Classification::is_preview()) {
    JS::load_from_key('jquery');
    JS::load('desktop/preview_util.php');
    JS::load('desktop/preview_menu.js');
}
/**
Exemplo n.º 11
0
Arquivo: css.php Projeto: ruucla/mwf
    require_once dirname(__FILE__) . '/css/default/full.css';
    foreach ($custom as $dir) {
        if (file_exists(dirname(__FILE__) . '/css/' . $dir . '/full.css')) {
            include_once dirname(__FILE__) . '/css/' . $dir . '/full.css';
        }
    }
}
/**
 * Load custom CSS files (minified) based on user agent.
 */
if (isset($_GET['basic'])) {
    foreach (explode(' ', $_GET['basic']) as $file) {
        if (Path_Validator::is_safe($file, 'css') && ($contents = Path::get_contents($file))) {
            echo ' ' . CSSMin::minify($contents);
        }
    }
}
if (User_Agent::is_standard() && isset($_GET['standard'])) {
    foreach (explode(' ', $_GET['standard']) as $file) {
        if (Path_Validator::is_safe($file, 'css') && ($contents = Path::get_contents($file))) {
            echo ' ' . CSSMin::minify($contents);
        }
    }
}
if (User_Agent::is_full() && isset($_GET['full'])) {
    foreach (explode(' ', $_GET['full']) as $file) {
        if (Path_Validator::is_safe($file, 'css') && ($contents = Path::get_contents($file))) {
            echo ' ' . CSSMin::minify($contents);
        }
    }
}
Exemplo n.º 12
0
Arquivo: img.php Projeto: ruucla/mwf
    if (isset($_GET['browser_height_percent'])) {
        $max_height = $max_height * $_GET['browser_height_percent'] / 100;
    }
    if (isset($_GET['max_height']) && $_GET['max_height'] < $max_height) {
        $max_height = $_GET['max_height'];
    }
}
/**
 * @var Local_Image work with a local version of the image specified in URI.
 */
$image = new Local_Image($_GET['img']);
/** GIF, JPG, and JPEG are within XHTML MP 1.0 specification. */
$image->set_allowed_extension('gif');
$image->set_allowed_extension('jpeg');
$image->set_allowed_extension('jpg');
/** Allow PNG if user agent has capability. */
if (User_Agent::has_capability('png')) {
    $image->set_allowed_extension('png');
}
/** Force max width if $set_width is true. */
if ($set_width) {
    $image->set_max_width($max_width);
}
/** For max height if $set_height is true. */
if ($set_height) {
    $image->set_max_height($max_height);
}
/** Output the header so that browser treats it as an image rather than PHP file. */
$image->output_header();
/** Output the binary content of the image in its compressed state. */
$image->output_image();
Exemplo n.º 13
0
Arquivo: css.php Projeto: ruucla/mwf
}
/**
 * Scripts that will be minified and included at the STANDARD level and above.
 */
if (User_Agent::is_standard() && (isset($_GET['standard']) || isset($_GET['touch']))) {
    $loadarr = isset($_GET['standard']) ? explode(' ', $_GET['standard']) : array();
    // Support for deprecated TOUCH parameter.
    if (isset($_GET['touch'])) {
        $loadarr = array_merge(explode(' ', $_GET['touch']), $loadarr);
    }
    foreach ($loadarr as $file) {
        if (Path_Validator::is_safe($file, 'css') && ($contents = Path::get_contents($file))) {
            echo CSSMin::minify($contents);
        }
    }
}
/**
 * Scripts that will be minified and included at the FULL level only.
 */
if (User_Agent::is_full() && (isset($_GET['full']) || isset($_GET['webkit']))) {
    $loadarr = isset($_GET['full']) ? explode(' ', $_GET['full']) : array();
    // Support for deprecated WEBKIT parameter.
    if (isset($_GET['webkit'])) {
        $loadarr = array_merge(explode(' ', $_GET['webkit']), $loadarr);
    }
    foreach ($loadarr as $file) {
        if (Path_Validator::is_safe($file, 'css') && ($contents = Path::get_contents($file))) {
            echo CSSMin::minify($contents);
        }
    }
}
Exemplo n.º 14
0
Arquivo: js.php Projeto: ruucla/mwf
 * @uses User_Agent
 */
/** Set the header type and a cache of zero because this is very dynamic. */
header('Content-Type: text/javascript');
header("Cache-Control: max-age=0");
/** User_Agent is required to determine visitor device type. */
@(require_once '../lib/user_agent.class.php');
@(include_once dirname(dirname(__FILE__)) . '/config.php');
/**
 * Script does nothing if class can't load, user isn't mobile, or the GET 'm'
 * parameter isn't set (meaning the script wouldn't know where to redirect).
 * This also does nothing if the User_Agent fetch fails. This is a safety
 * fallback to leave the behavior on other sites as though they're already
 * on the other site.
 */
if (!class_exists('User_Agent') || User_Agent::get() === false || !User_Agent::is_mobile(false) || !isset($_GET['m'])) {
    die;
}
/** The page to redirect to is GET 'm' */
$mobile_page = $_GET['m'];
/**
 * The domain specifies a suffix that is optionally appended to the cookie name
 * to create an override setting for only particular pages.
 */
$domain_key = isset($_GET['d']) ? '_' . substr(md5($_GET['d']), 0, 8) : '';
/** Check to see if an override cookie exists. */
$cookie_override = isset($_COOKIE[Config::get('global', 'cookie_prefix') . 'ovrrdr' . $domain_key]) && $_COOKIE[Config::get('global', 'cookie_prefix') . 'ovrrdr' . $domain_key] == 1 ? 1 : 0;
/** The referrer is the page including this script - it may include GET 'ovrrdr'. */
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$referer_uri = strpos($referer, '?') !== false ? substr($referer, strpos($referer, '?') + 1, strlen($referer) - strpos($referer, '?') - 1) : '';
/** Find GET 'ovrrdr' if it exists in the referrer's URI. */
Exemplo n.º 15
0
Arquivo: index.php Projeto: ruucla/mwf
    die('<h1>Fatal Error</h1><p>The configuration settings {global::site_url} and {global::site_asset_url} must be defined in ' . dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'global.php</p>');
}
/**
 * Set an override for the classification if $_GET['ovrcls'] is defined, unset
 * it if $_GET['unovrcls'] is defined (unary), or redirect if non-mobile and
 * {'global':'site_nonmobile_url'} is true.
 */
if (isset($_GET['ovrcls'])) {
    User_Agent::set_override($_GET['ovrcls']);
    header('Location: ' . Config::get('global', 'site_url'));
} else {
    if (isset($_GET['unovrcls'])) {
        User_Agent::unset_override();
        header('Location: ' . Config::get('global', 'site_url'));
    } else {
        if (!User_Agent::is_mobile() && ($nonmobile_url = Config::get('global', 'site_nonmobile_url'))) {
            header('Location: ' . $nonmobile_url);
        }
    }
}
/**
 * Get the menu from {'frontpage':'menu'} defined in config/frontpage.php.
 */
$menu = Config::get('frontpage', 'menu');
/**
 * Handle differences between a subsection and the top-level menu, using key
 * 'default' if on the front page or otherwise the $_GET['s'] parameter.
 */
if (isset($_GET['s']) && isset($menu[$_GET['s']])) {
    $menu_items = $menu[$_GET['s']];
    $main_menu = false;
Exemplo n.º 16
0
 /**
  * Static initializer for User_Agent that loads capabilities from the cookie
  * into a static object via self::parse_capabilities. If a cookie is not
  * set, this returns false.
  * 
  * @return bool
  */
 public static function init()
 {
     /**
      * If initialized, return initialized value without reprocessing.
      */
     if (self::$_init !== null) {
         return self::$_init;
     }
     /**
      * Define name of the cookie set by asets/js/core/server.js.
      */
     self::$_name = 'user_agent';
     /**
      * Contents of the cookie set by asets/js/core/server.js.
      */
     self::$_cookie = Cookie::get(self::$_name);
     /**
      * If cookie is set, extract contents and parse the JSON into a PHP
      * object, then setting initialized value to true. Otherwise, set it
      * false, as initialization has failed since no cookie is defined.
      */
     if (isset(self::$_cookie)) {
         self::$_user_agent = self::parse(self::$_cookie);
         self::$_init = true;
     } else {
         self::$_init = false;
     }
     /**
      * Return whether initialization succeeded or failed.
      */
     return self::$_init;
 }