if ($online_visits_array['members']) { $str_online .= JText::sprintf('members', $online_visits_array['members']) . ', '; } if ($online_visits_array['bots']) { $str_online .= JText::sprintf('bots', $online_visits_array['bots']) . ', '; } $str_online = substr($str_online, 0, -7); $html .= $str_online . ' ' . JText::sprintf('online'); $html .= '<br />'; } if ($s_ip) { $html .= $guestip . ": " . $ip . "<br />"; } if ($s_guestinfo) { //require_once(JPATH_ADMINISTRATOR.DS."components".DS."com_vvisit_counter".DS."helpers".DS."browsers.php"); $browser = _browser(); if (!empty($browser)) { $html .= $browser['browser'] == "msie" ? "Internet Explorer" : ucwords($browser['browser']); $html .= " "; $html .= $browser['version']; $html .= ", "; $html .= ucwords($browser['platform']); $html .= "<br /> "; } } if ($s_timenow) { $html .= $time->toFormat($formattime); } $html .= '</div>'; } // END: SHOW GUEST'S INFO
// So, getting the "Windows NT" part from the useragent, we can known the Windows version :-) // ----------------------------------------------------------------------------------- $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b2pre) Gecko/2007120505 Minefield/3.0b2pre'; $ret = _browser('windows nt', false, false, false, true); _print('Windows array', $ret); $windows_array = array('6.1' => 'Windows 7', '6.0' => 'Windows Vista', '5.2' => 'Windows Server 2003 or Windows XP x64', '5.1' => 'Windows XP'); if (isset($windows_array[$ret['version']])) { _print('Client is using', $windows_array[$ret['version']]); } else { _print('Windows version not found.'); } // ----------------------------------------------------------------------------------- // Detect if Windows version is below or above a determined version. // Based on $windows_array you can determine the version number for the condition. // ----------------------------------------------------------------------------------- $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b2pre) Gecko/2007120505 Minefield/3.0b2pre'; $windows_array = array('6.1' => 'Windows 7', '6.0' => 'Windows Vista', '5.2' => 'Windows Server 2003 or Windows XP x64', '5.1' => 'Windows XP'); $ret = _browser('windows nt', false, false, false, true); if (isset($ret['version']) && !empty($ret['version'])) { $detect_by_name = 'Windows Vista'; $detect_by_number = array_search($detect_by_name, $windows_array); if ($ret['version'] == $detect_by_number) { _print('Detected version (' . $windows_array[$ret['version']] . ') is equal to ' . $windows_array[$detect_by_number]); } elseif ($ret['version'] <= $detect_by_number) { _print('Detected version ' . $windows_array[$ret['version']] . ' is below to ' . $windows_array[$detect_by_number]); } else { _print('Detected version ' . $windows_array[$ret['version']] . ' is above to ' . $windows_array[$detect_by_number]); } } else { _print('Windows version not found.'); }
function _layout($template, $page_title = false, $v_custom = false) { global $core, $bio, $style, $starttime; // GZip if (_browser('gecko')) { ob_start('ob_gzhandler'); } // Headers if (!headers_sent()) { header('Cache-Control: private, no-cache="set-cookie", pre-check=0, post-check=0'); header('Expires: 0'); header('Pragma: no-cache'); } if ($page_title !== false) { if (!is_array($page_title)) { $page_title = w($page_title); } foreach ($page_title as $k => $v) { $page_title[$k] = $bio->_lang($v); } $page_title = implode(' . ', $page_title); } $sql = 'SELECT module_alias, module_name FROM _modules WHERE module_header = 1 AND module_active = 1 ORDER BY module_order'; $header_menu = sql_rowset($sql); foreach ($header_menu as $i => $row) { if (!$i) { _style('nav'); } _style('nav.menu', array('ACTIVE' => false, 'HREF' => _link($row->module_alias), 'NAME' => $row->module_name)); } // $filename = strpos($template, '#') !== false ? str_replace('#', '.', $template) : $template . '.htm'; $style->set_filenames(array('body' => $filename)); // SQL History if ($core->v('show_sql_history')) { foreach (sql_history() as $i => $row) { if (!$i) { _style('sql_history'); } _style('sql_history.row', array('QUERY' => str_replace(array("\n", "\t"), array('<br />', ' '), $row))); } } //_pre($bio, true); // $v_assign = array('USER_ID' => $bio->v('bio_id'), 'USER_NAME' => $bio->v('bio_name'), 'SITE_TITLE' => $core->v('site_title'), 'PAGE_TITLE' => $page_title, 'G_ANALYTICS' => $core->v('google_analytics'), 'S_REDIRECT' => $bio->v('session_page'), 'F_SQL' => sql_queries()); if ($v_custom !== false) { $v_assign += $v_custom; } $mtime = explode(' ', microtime()); $v_assign['F_TIME'] = sprintf('%.2f', $mtime[0] + $mtime[1] - $starttime); v_style($v_assign); $style->pparse('body'); sql_close(); exit; }
public function home() { global $user; $v = $this->__(w('f e')); if (array_empty($v)) { _fatal(); } $location = './style/' . $v['e'] . '/'; $filename = _filename($v['f'], $v['e']); if (!@is_dir($location)) { _fatal(); } if ($v['e'] == 'css' && $v['f'] != 'default') { $v['field'] = !is_numb($v['f']) ? 'alias' : 'id'; $sql = 'SELECT * FROM _tree WHERE tree_?? = ? LIMIT 1'; if (!($tree = _fieldrow(sql_filter($sql, $v['field'], $v['f'])))) { _fatal(); } $filetree = _rewrite($tree); $filename = _filename('_tree_' . $filetree, $v['e']); } // 304 Not modified response header if (@file_exists($location . $filename)) { $f_last_modified = gmdate('D, d M Y H:i:s', filemtime($location . $filename)) . ' GMT'; $http_if_none_match = v_server('HTTP_IF_NONE_MATCH'); $http_if_modified_since = v_server('HTTP_IF_MODIFIED_SINCE'); header('Last-Modified: ' . $f_last_modified); if ($f_last_modified == $http_if_modified_since) { header('HTTP/1.0 304 Not Modified'); header('Content-Length: 0'); exit; } } switch ($v['e']) { case 'css': if ($v['f'] != 'default') { $filetree = _rewrite($tree); $filename = _filename('_tree_' . $filetree, $v['e']); if (!@file_exists($location . $filename)) { _fatal(); } } $browser = _browser(); if (f($browser['browser'])) { $custom = array($browser['browser'] . '-' . $browser['version'], $browser['browser']); foreach ($custom as $row) { $handler = _filename('_tree_' . $row, 'css'); if (@file_exists($location . $handler)) { _style('includes', array('CSS' => _style_handler('css/' . $handler))); } } } break; case 'js': if (!@file_exists($location . $filename)) { _fatal(); } _style_vreplace(false); break; } v_style(array('SPATH' => LIBD . 'visual')); sql_close(); $ext = _style_handler($v['e'] . '/' . $filename); switch ($v['e']) { case 'css': $content_type = 'text/css; charset=utf-8'; $ext = preg_replace('#(border-radius\\-?.*?)\\: ?(([0-9]+)px;)#is', _browser('firefox') || _browser('namoroka') ? '-moz-\\1: \\2' : '', $ext); $ext = preg_replace('/(#([0-9A-Fa-f]{3})\\b)/i', '#\\2\\2', $ext); $ext = preg_replace('#\\/\\*(.*?)\\*\\/#is', '', $ext); $ext = str_replace(array("\r\n", "\n", "\t"), '', $ext); break; case 'js': $content_type = 'application/x-javascript'; require_once XFS . 'core/jsmin.php'; $ext = JSMin::minify($ext); break; } ob_start('ob_gzhandler'); header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 60 * 60 * 24 * 30) . ' GMT'); header('Content-type: ' . $content_type); echo $ext; exit; }
function _layout($template, $page_title = false, $v_custom = false) { global $core, $user, $style, $starttime; // GZip if (_browser('gecko')) { ob_start('ob_gzhandler'); } // Headers if (!headers_sent()) { header('Cache-Control: private, no-cache="set-cookie", pre-check=0, post-check=0'); header('Expires: 0'); header('Pragma: no-cache'); } if ($page_title !== false) { if (!is_array($page_title)) { $page_title = w($page_title); } foreach ($page_title as $k => $v) { $page_title[$k] = _lang($v); } $page_title = implode(' . ', $page_title); } // _lib_define(); $filename = strpos($template, '#') !== false ? str_replace('#', '.', $template) : $template . '.htm'; $style->set_filenames(array('body' => $filename)); // SQL History if ($core->v('show_sql_history')) { foreach (_sql_history() as $i => $row) { if (!$i) { _style('sql_history'); } _style('sql_history.row', array('QUERY' => str_replace(array("\n", "\t"), array('<br />', ' '), $row))); } } // $v_assign = array('SITE_TITLE' => $core->v('site_title'), 'PAGE_TITLE' => $page_title, 'G_ANALYTICS' => $core->v('google_analytics'), 'S_REDIRECT' => $user->v('session_page'), 'F_SQL' => _sql_queries()); if ($v_custom !== false) { $v_assign += $v_custom; } $mtime = explode(' ', microtime()); $v_assign['F_TIME'] = sprintf('%.2f', $mtime[0] + $mtime[1] - $starttime); v_style($v_assign); $style->pparse('body'); sql_close(); exit; }
public function home() { global $warning, $bio, $core, $warning; $v = $this->__(w('path ext')); if (array_empty($v)) { $warning->now(); } $location = XFS . XHTM . _tbrowser() . '/' . $v->ext . '/'; if (!@is_dir($location)) { $warning->now(); } $filename = _filename($v->path, $v->ext); if ($v->ext == 'css' && $v->path != 'default') { $v->field = !is_numb($v->path) ? 'alias' : 'id'; $sql = 'SELECT * FROM _tree WHERE tree_?? = ? LIMIT 1'; if (!($tree = sql_fieldrow(sql_filter($sql, $v->field, $v->path)))) { $warning->now(); } $filetree = _rewrite($tree); $filename = _filename('_tree_' . $filetree, $v->ext); } // // 304 Not modified response header if (@file_exists($location . $filename)) { $f_last_modified = gmdate('D, d M Y H:i:s', filemtime($location . $filename)) . ' GMT'; $http_if_none_match = v_server('HTTP_IF_NONE_MATCH'); $http_if_modified_since = v_server('HTTP_IF_MODIFIED_SINCE'); header('Last-Modified: ' . $f_last_modified); if ($f_last_modified == $http_if_modified_since) { header('HTTP/1.0 304 Not Modified'); header('Content-Length: 0'); exit; } } switch ($v->ext) { case 'css': if ($v->path != 'default') { $filetree = _rewrite($tree); $filename = _filename('_tree_' . $filetree, $v->ext); if (!@file_exists($location . $filename)) { $warning->now(); } } $browser = _browser(); if (!empty($browser['browser'])) { $custom = array($browser['browser'] . '-' . $browser['version'], $browser['browser']); foreach ($custom as $row) { $handler = _filename('_tree_' . $row, 'css'); if (@file_exists($location . $handler)) { _style('includes', array('CSS' => _style_handler('css/' . $handler))); } } } _style_vreplace(false); break; case 'js': if (!@file_exists($location . $filename)) { $warning->now(); } _style_vreplace(false); break; } v_style(array('DOMAIN' => 'media')); sql_close(); // // Headers $ext = _style_handler($v->ext . '/' . $filename); switch ($v->ext) { case 'css': $content_type = 'text/css; charset=utf-8'; //$ext = preg_replace('#(border-radius\-?.*?)\: ?(([0-9]+)px;)#is', ((_browser('firefox')) ? '-moz-\1: \2' : ''), $ext); $ext = preg_replace('/(#([0-9A-Fa-f]{3})\\b)/i', '#\\2\\2', $ext); $ext = preg_replace('#\\/\\*(.*?)\\*\\/#is', '', $ext); $ext = str_replace(array("\r\n", "\n", "\t"), '', $ext); break; case 'js': $content_type = 'application/x-javascript'; require_once XFS . XCOR . 'jsmin.php'; $ext = JSMin::minify($ext); break; } ob_start('ob_gzhandler'); header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 2592000) . ' GMT'); // 30 days = 60 * 60 * 24 * 30 header('Content-type: ' . $content_type); echo $ext; exit; }
public final function e($m = '') { if ($m == '!' && !$this->errors()) { return false; } // GZip if (_browser('gecko')) { ob_start('ob_gzhandler'); } // Headers if (!headers_sent()) { header('Cache-Control: private, no-cache="set-cookie", pre-check=0, post-check=0'); header('Expires: 0'); header('Pragma: no-cache'); } sql_close(); if (is_object($m) || is_array($m)) { _pre($m); } else { if (is_lang($m)) { $m = _lang($m); } elseif ($m == '!') { $m = '#' . $this->get_errors(); } elseif (($s = substr($m, 0, 1)) == '~') { $m = str_replace($s, '', $m); $m = isset($this->je[$m]) ? $this->je[$m] : $this->je['OK']; } echo $m; } exit; }
function is_browser_support() { require_once dirname(__FILE__) . "/xbd/xbd.php"; $wptkf_browser_support_settings = get_option('wptkf_browser_support_settings'); if ($wptkf_browser_support_settings == 'false') { return 1; } else { $browser_agent = 0; if (_browser('chrome', '>= 3.1')) { $browser_agent = 1; } elseif (_browser('safari', '>= 3.1')) { $browser_agent = 1; } elseif (_browser('firefox', '>= 3.5')) { $browser_agent = 1; } elseif (_browser('msie', '>= 4.0')) { $browser_agent = 1; } elseif (_browser('opera', '>= 10')) { $browser_agent = 1; } elseif (_browser('netscape', '>= 4.0')) { $browser_agent = 1; } if ($browser_agent == '1') { return 1; } } }
public function run($mod = false) { global $bio, $core, $file, $warning; if (!($rewrite = enable_rewrite())) { $warning->now('Enable mod_rewrite on Apache.'); } require_once XFS . XCOR . 'modules.php'; if ($mod === false) { $mod = request_var('module', ''); } $mod = !empty($mod) ? $mod : 'home'; if (!($_module = $core->cache->load('module_' . str_replace('/', '_', $mod)))) { $sql = 'SELECT * FROM _modules WHERE module_alias = ?'; if (!($_module = $core->cache->store(sql_fieldrow(sql_filter($sql, $mod))))) { $warning->now('no_module'); } } $_module->module_path = XFS . XMOD . $_module->module_path . $_module->module_basename; if (!@file_exists($_module->module_path)) { $warning->now('no_path: ' . $_module->module_path); } @(require_once $_module->module_path); $_object = '__' . $mod; if (!class_exists($_object)) { $warning->now(); } $module = new $_object(); $module->m($mod); if (@method_exists($module, 'install')) { $module->_install(); } if (!defined('ULIB')) { define('ULIB', _link() . str_replace(w('../ ./'), '', LIB)); } if (empty($this->input)) { $_input = array(); if ($arg = request_var('args', '')) { foreach (explode('.', $arg) as $str_pair) { $pair = explode(':', $str_pair); if (isset($pair[0]) && isset($pair[1]) && !empty($pair[0])) { $this->input[$pair[0]] = $pair[1]; } } } if (isset($_POST) && count($_POST)) { $_POST = _utf8($_POST); $this->input = array_merge($this->input, $_POST); } } $module->levels($this->input); if (!method_exists($module, $module->x(1))) { $warning->now(); } if ($module->auth() && (!$module->x(1) || !in_array($module->x(1), $module->exclude))) { $module->signin(); } // // All verifications passed, so start session for the request $bio->start(true); $bio->setup(); if (!$module->auth_access() && $module->auth()) { $warning->now(); } $module->navigation('home', '', ''); $module->navigation($module->m(), ''); if ($module->x(1) != 'home' && @method_exists($module, 'init')) { $module->init(); } hook(array($module, $module->x(1))); if (!$module->_template()) { $module->_template($mod); } // // Output template $page_module = 'MODULE_' . $mod; if ($bio->is_lang($page_module)) { $module->page_title($page_module); } $browser_upgrade = false; if (!$core->v('skip_browser_detect') && ($list_browser = $file->read(XFS . XCOR . 'store/need_browser'))) { $browser_list = w(); foreach ($list_browser as $row) { $e = explode(' :: ', $row); $browser_list[$e[0]] = $e[1]; } foreach ($browser_list as $browser => $version) { if (_browser($browser) && _browser($browser, $version)) { v_style(array('visual' => ULIB . LIB_VISUAL)); $module->_template('browsers'); $browser_upgrade = true; } } } $sv = array('X1' => $module->x(1), 'X2' => $module->x(2), 'NAVIGATION' => $module->get_navigation(), 'BROWSER_UPGRADE' => $browser_upgrade); _layout($module->_template(), $module->page_title(), $sv); }