public function action_save() { $msg = ''; $user_id = $this->request->post('user_id'); $b = new Browser(); $url = "https://api.vk.com/method/users.get?user_ids=" . $user_id; $response = $b->openUrl($url)->jsonAsArray(); if (isset($response['response'])) { foreach ($response['response'] as $user) { $userRecord = ORM::factory('User')->where('user_id', '=', $user['uid'])->find_all(); if (count($userRecord)) { $msg = 'Пользователь уже добавлен'; $this->template->content = View::factory('msg/error')->bind('msg', $msg); } else { $newUser = ORM::factory('User'); $newUser->user_id = $user['uid']; $newUser->first_name = $user['first_name']; $newUser->last_name = $user['last_name']; if ($newUser->save()) { $msg = "Добавлен"; $this->template->content = View::factory('msg/success')->bind('msg', $msg); } } } } }
public function updateStats($manufacturer_id, $customer_id) { $this->load->library('browser'); $browser = new Browser(); $this->db->query("UPDATE " . DB_PREFIX . "manufacturer SET viewed = viewed + 1 WHERE manufacturer_id = '" . (int) $manufacturer_id . "'"); $this->db->query("INSERT " . DB_PREFIX . "stat SET \n `object_id` = '" . (int) $manufacturer_id . "',\n `store_id` = '" . (int) STORE_ID . "',\n `customer_id` = '" . (int) $customer_id . "',\n `object_type` = 'manufacturer',\n `server` = '" . $this->db->escape(serialize($_SERVER)) . "',\n `session` = '" . $this->db->escape(serialize($_SESSION)) . "',\n `request` = '" . $this->db->escape(serialize($_REQUEST)) . "',\n `store_url` = '" . $this->db->escape($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']) . "',\n `ref` = '" . $this->db->escape($_SERVER['HTTP_REFERER']) . "',\n `browser` = '" . $this->db->escape($browser->getBrowser()) . "',\n `browser_version`= '" . $this->db->escape($browser->getVersion()) . "',\n `os` = '" . $this->db->escape($browser->getPlatform()) . "',\n `ip` = '" . $this->db->escape($_SERVER['REMOTE_ADDR']) . "',\n `date_added` = NOW()"); }
function cacheurl($url, $browser_req = true, $cookies = "", $browser = "Firefox") { global $myconfig; #find cache file $hash = md5($url); $datei = "cache/" . $hash; if (file_exists($datei)) { if (time() - filemtime($datei) < $myconfig['cachetime']) { return implode('', file($datei)); } } #no cache file exists send browser request if ($browser_req == true) { $objekt = new Browser($browser); if ($cookies != "") { $objekt->cookies_set($cookies); } $objekt->url = $url; $t_html = $objekt->read(); } else { $t_html = implode('', file($url)); } d_write($datei, $t_html); return $t_html; }
public function action_index() { if (!function_exists('imagetypes')) { die("ERROR: GD LIB IS NOT LOADED!"); } //header("Content-type: image/png"); $this->response->headers('Content-type', 'image/png'); /*=================*/ $im = @imagecreatefrompng(APPPATH . "cover.png"); //读取图片名 $color = imagecolorallocate($im, 183, 150, 37); //文字颜色 $client_address = $_SERVER["REMOTE_ADDR"]; //$user_agent = $_SERVER['HTTP_USER_AGENT']; //$client_system = $this->_get_system($user_agent); //$client_browser = $this->_get_browser($user_agent); $browser = new Browser(); $client_system = $browser->getPlatform(); $client_browser = $browser->getBrowser(); imagestring($im, 3, 125, 44, "[ From {$client_address} / {$client_system} / {$client_browser} ]", $color); //($im,字大小,左右,上下) imagepng($im); imagedestroy($im); //$this->response->body(''); }
public function do_help() { $user = Sentry::getUser(); $subject = "Newsletter Help: " . Input::get('subject'); $emailbody = Input::get('message'); $from_name = $user->first_name . ' ' . $user->last_name; $from_email = $user->email; $admin = User::first(); $to_name = $admin->first_name . ' ' . $admin->last_name; $to_email = $admin->email; $rules = array('subject' => 'required|max:128', 'message' => 'required'); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { return Redirect::to('dashboard/help')->withErrors($validator); } else { $browser = new Browser(); $userbrowser = $browser->getBrowser() . ' ' . $browser->getVersion(); $userplatform = $browser->getPlatform(); $userIP = $_SERVER["REMOTE_ADDR"]; $page = URL::current(); $data = array('emailbody' => $emailbody, 'userbrowser' => $userbrowser, 'userplatform' => $userplatform, 'userIP' => $userIP, 'page' => $page); $issent = Mail::send('emails.help-email', $data, function ($message) use($from_email, $from_name, $subject, $to_name, $to_email) { $message->from($from_email, $from_name)->to($to_email, $to_name)->subject($subject); }); if ($issent) { return Redirect::to('dashboard/help')->with('success', 'Success! You will be contacted soon regarding your issue.'); } else { return Redirect::to('dashboard/help')->with('error', 'An error was encountered sending the email. Please try again.'); } } }
public static function log($logType, $user = false, $data1 = false) { $browser = new Browser(); $text = ''; $timestamp = time(); if ($user !== false) { $userId = $user->get('id'); } else { $userId = 0; } $data = ''; switch ($logType) { case 3: foreach ($data1 as $key => $value) { $data .= ' ' . $key . ': ' . $value . '|'; } break; case 4: $data = 'Plattform: ' . $browser->getPlatform() . ' | Browser: ' . $browser->getBrowser() . ' | Version: ' . $browser->getVersion() . ' | UserAgent: ' . $browser->getUserAgent(); break; default: break; } $text = Texter::get('log|' . $logType); database::Query('INSERT INTO log (`type`, `text`, `data`, `userId`, `timestamp`) VALUES (' . $logType . ', :var1, :var2, :var3, :var4);', array('var1' => $text, 'var2' => $data, 'var3' => $userId, 'var4' => $timestamp)); }
function setThemeMode() { require 'phppi/includes/classes/browser.php'; $browser = new Browser(); $this->vars['isIE'] = false; switch ($browser->getBrowser()) { case Browser::BROWSER_ANDROID: $this->vars['theme_mode'] = 'mobile'; if ($this->settings['disable_popup_image_viewer_for_mobile'] == true) { $this->settings['use_popup_image_viewer'] = false; } break; case Browser::BROWSER_IPHONE: $this->vars['theme_mode'] = 'mobile'; if ($this->settings['disable_popup_image_viewer_for_mobile'] == true) { $this->settings['use_popup_image_viewer'] = false; } break; case Browser::BROWSER_IPOD: $this->vars['theme_mode'] = 'mobile'; if ($this->settings['disable_popup_image_viewer_for_mobile'] == true) { $this->settings['use_popup_image_viewer'] = false; } break; case Browser::BROWSER_IE: $this->vars['theme_mode'] = 'standard'; $this->vars['isIE'] = true; break; default: $this->vars['theme_mode'] = 'standard'; break; } }
/** * {@inheritDoc} */ public function __construct(array $attributes = array()) { $browser = new Browser(); $attributes['version'] = $browser->getVersion(); $attributes['platform'] = $browser->getPlatform(); $attributes['browser'] = $browser->getBrowser(); parent::__construct($attributes); }
function ie_version($output) { $browser = new Browser(); if ($browser->getBrowser() == Browser::BROWSER_IE && $browser->getVersion() < 10) { return $output . ' class="ie"'; } else { return $output; } }
public function __construct() { $browser = new Browser(); /* browser name */ $browser_name = null; switch ($browser->getBrowser()) { case Browser::BROWSER_CHROME: $browser_name = 'chrome'; $this->addClass('webkit'); break; case Browser::BROWSER_FIREFOX: $browser_name = 'firefox'; break; case Browser::BROWSER_IE: $browser_name = 'ie'; break; case Browser::BROWSER_SAFARI: $browser_name = 'safari'; $this->addClass('webkit'); break; case Browser::BROWSER_OPERA: $browser_name = 'opera'; $this->addClass('webkit'); break; default: $browser_name = strtolower(str_replace(' ', '', $browser->getBrowser())); } /* browser version */ $version = explode('.', $browser->getVersion()); $version = is_array($version) && count($version) ? $version[0] : ''; /* browser platform */ $platform = null; switch ($browser->getPlatform()) { case Browser::PLATFORM_ANDROID: $platform = 'android'; break; case Browser::PLATFORM_APPLE: $platform = 'mac'; break; case Browser::PLATFORM_IPAD: $platform = 'ipad'; break; case Browser::PLATFORM_IPHONE: $platform = 'iphone'; break; case Browser::PLATFORM_LINUX: $platform = 'linux'; break; case Browser::PLATFORM_WINDOWS: $platform = 'win'; break; } /* add classes */ $this->addClass($browser_name); $this->addClass($browser_name . $version); $this->addClass($platform); }
public function add() { $this->load->library('browser'); $browser = new Browser(); if ($browser->getBrowser() != 'GoogleBot') { $sql = "INSERT INTO " . DB_PREFIX . "search SET \r\n `customer_id` = '" . (int) $this->customer->getId() . "',\r\n store_id = '" . (int) STORE_ID . "', \r\n `request` = '" . $this->db->escape(serialize($_REQUEST)) . "',\r\n `urlQuery` = '" . $this->db->escape($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']) . "',\r\n `browser` = '" . $this->db->escape($browser->getBrowser()) . "',\r\n `browser_version`= '" . $this->db->escape($browser->getVersion()) . "',\r\n `os` = '" . $this->db->escape($browser->getPlatform()) . "',\r\n `ip` = '" . $this->db->escape($_SERVER['REMOTE_ADDR']) . "',\r\n `date_added` = NOW()"; $this->db->query($sql); return $this->db->getLastId(); } }
public function set($message, $params = array()) { $browser = new Browser(); $model = new Timeline(); $model->user_id = Yii::app()->user->id; $model->message = Yii::t('timeline', $message, $params); $model->user_agent = $browser->getUserAgent(); $model->ip = CMS::getip(); $model->user_platform = $browser->getPlatform(); $model->save(false, false, false); }
private function initCanvas($data) { $data = json_decode($data); $this->ip = $this->validateInput($_SERVER['REMOTE_ADDR']); $this->message = filter_var($data->note, FILTER_SANITIZE_STRING); $browser = new Browser(); $this->browser = "Name of browser " . $browser->getBrowser() . " Version " . $browser->getVersion(); $this->isBrowserMobile = $browser->isMobile(); $this->url = is_null($data->url) ? null : $data->url; if (!is_null($data->img)) { $this->img = $data->img; } }
/** * Parse the video url of a given myvideo video link site * and returns the http url of the video * * * @param string $url * url of video must contain watch/* * http://www.myvideo.de/watch/7125794 * @return string * the url of the video as http url; should the flv file */ function myvideo_flv_download($url) { preg_match('|watch/(\\d+)/|i', $url, $match); $objekt = new Browser($browser); if ($cookies != "") { $objekt->cookies_set($cookies); } $objekt->url = "http://www.myvideo.de/movie/" . $match[1]; $objekt->read(); $head = $objekt->returnHeader(); preg_match('/V\\=(.*?).flv/', $head['Location'], $matches); return urldecode($matches[1]) . ".flv"; }
public function action_index($page = null) { $data['table'] = null; try { $browser = new Browser(); $data['table'] = $browser->bidding($page); } catch (BrowserLoginException $e) { Session::set_flash('alert', ['status' => 'danger', 'message' => e("Login error: " . $e->getMessage())]); } catch (ParserException $e) { Session::set_flash('alert', ['status' => 'danger', 'message' => e("Parser error: " . $e->getMessage())]); } $this->template->title = 'Bidding list'; $this->template->content = View::forge('admin/bidding/index', $data); }
function getLogLogin($q) { $queris = "SELECT * FROM t_loglogin_bnc where uname = '" . $this->db->amanin($q) . "' order by id DESC LIMIT 5"; $data = $this->db->selectData($queris); $h = ""; for ($i = 0; $i < count($data); $i++) { $browser = new Browser($data[$i]["user_agent"]); $h .= '<li class="collection-item dismissable">'; $h .= '<label for="task1">' . $browser->getOS() . '/' . $browser->getBrowser() . ' ' . $browser->getVersion() . '<a href="javascript:void(0);" class="secondary-content"><span class="ultra-small">' . $this->ubahTimeStamp($data[$i]["tgl"]) . '</span></a></label>'; $h .= '<span class="task-cat teal">' . $data[$i]["ip"] . '</span>'; $h .= '</li>'; } return $h; }
private function getHeaders($url) { loadNitroLib('browser'); $browser = new Browser($url); try { $browser->fetch("HEAD"); $headers = $browser->getHeaders(); } catch (Exception $e) { if (NITRO_DEBUG_MODE) { $this->log->write('[NitroBrowser]: ' . $e->getMessage()); } return false; } return $headers; }
static function getAllCaps() { if (self::$__caps == null) { self::$__caps = get_browser(null, true); } return self::$__caps; }
public function getOSData() { $cols = array('meta1', 'clicks', 'click_throughs', 'click_through_rates', 'leads', 'conv', 'payout', 'epc', 'income'); $sql = 'select adv.platform_id, '; $sql .= getReportGeneralSelects() . 'from '; $sql .= getReportFilters('platforms/os', 'left join bt_s_clicks_advanced as adv on (click.click_id=adv.click_id)'); $sql .= ' and adv.platform_id > 0 group by adv.platform_id '; $result = DB::getRows($sql); $cnt = count($result); DB::query("delete from bt_c_statcache where user_id='" . DB::quote(getUserId()) . "' and type='platos'"); $bulk = new DB_Bulk_Insert('bt_c_statcache', array('user_id', 'type', 'clicks', 'click_throughs', 'click_through_rates', 'leads', 'conv', 'payout', 'epc', 'income', 'meta1')); foreach ($result as $row) { $row['platform_name'] = Browser::getPlatformName($row['platform_id']); if (!$row['platform_name']) { $row['platform_name'] = '[unknown os]'; } $bulk->insert(array(DB::quote(getUserId()), "'platos'", $row['clicks'], $row['click_throughs'], $row['click_through_rates'], $row['leads'], $row['conv'], $row['payout'], $row['epc'], $row['income'], "'" . DB::quote($row['platform_name']) . "'")); } $bulk->execute(); $sql = "select * from bt_c_statcache where user_id='" . DB::quote(getUserId()) . "' and type='platos' "; $sql .= getReportOrder($cols); $sql .= getReportLimits(); $result = DB::getRows($sql); return array('data' => $result, 'cnt' => $cnt, 'cols' => $cols); }
function assignCompanyInfoAndTheme() { $this->assign('url', Settings::Get('hosturl', Resources::Get('site.url'))); $this->assign('company', Settings::Get('company_name', Resources::Get('company.webim'))); $this->assign('logo', Settings::Get('logo', WEBIM_ROOT . '/themes/default/images/logo.gif')); $this->assign('theme', Browser::getCurrentTheme()); }
/** * * @param Application $app * @param databox $databox * @param Browser $browser * * @return Session_Logger */ public static function create(Application $app, databox $databox, Browser $browser) { $colls = []; if ($app['authentication']->getUser()) { $bases = $app['acl']->get($app['authentication']->getUser())->get_granted_base([], [$databox->get_sbas_id()]); foreach ($bases as $collection) { $colls[] = $collection->get_coll_id(); } } $conn = $databox->get_connection(); $sql = "INSERT INTO log\n (id, date,sit_session, user, site, usrid, nav,\n version, os, res, ip, user_agent,appli, fonction,\n societe, activite, pays)\n VALUES\n (null,now() , :ses_id, :usr_login, :site_id, :usr_id\n , :browser, :browser_version, :platform, :screen, :ip\n , :user_agent, :appli, :fonction, :company, :activity, :country)"; $params = [':ses_id' => $app['session']->get('session_id'), ':usr_login' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getLogin() : null, ':site_id' => $app['conf']->get(['main', 'key']), ':usr_id' => $app['authentication']->isAuthenticated() ? $app['authentication']->getUser()->getId() : null, ':browser' => $browser->getBrowser(), ':browser_version' => $browser->getExtendedVersion(), ':platform' => $browser->getPlatform(), ':screen' => $browser->getScreenSize(), ':ip' => $browser->getIP(), ':user_agent' => $browser->getUserAgent(), ':appli' => serialize([]), ':fonction' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getJob() : null, ':company' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getCompany() : null, ':activity' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getActivity() : null, ':country' => $app['authentication']->getUser() ? $app['authentication']->getUser()->getCountry() : null]; $stmt = $conn->prepare($sql); $stmt->execute($params); $log_id = $conn->lastInsertId(); $stmt->closeCursor(); $sql = "INSERT INTO log_colls (id, log_id, coll_id) VALUES (null, :log_id, :coll_id)"; $stmt = $conn->prepare($sql); foreach ($colls as $collId) { $stmt->execute([':log_id' => $log_id, ':coll_id' => $collId]); } $stmt->closeCursor(); unset($stmt, $conn); return new Session_Logger($databox, $log_id); }
/** * Public class constructor * @access public * @throws Exception when user has already been registered */ public function __construct() { if (isset($_SESSION['visitor']) && $_SESSION['visitor'] == "accessed") { throw new Exception("User already registered", 1); } else { $this->dateTime = Carbon::now(); $this->browser = BrowserDetect::browserFamily(); $this->OS = BrowserDetect::osName(); if (BrowserDetect::isMobile()) { $this->deviceType = "mobile"; } elseif (Browser::isTablet()) { $this->deviceType = "tablet"; } elseif (Browser::isDesktop()) { $this->deviceType = "desktop"; } elseif (Browser::isBot()) { $this->deviceType = "bot"; } else { $this->deviceType = "unknown"; } $this->deviceFamily = Broswer::deviceFamily(); $this->deviceModel = Browser::deviceModel(); $this->broadcastAddress = $_SERVER["REMOTE_ADDR"]; $this->model = new AccessModel($this); } }
public static function getInstance() { if (self::$instance === NULL) { self::$instance = new self(); } return self::$instance; }
public function invoke(User $user, $handlerName) { $user->validate(); include_once RUDRA . "/core/handler/AbstractHandler.php"; $handleCache = new RxCache("handlers", true); global $temp; $className; if ($handleCache->hasKey($handlerName)) { $classObj = $handleCache->get($handlerName); include_once $classObj["filePath"]; $className = $classObj["className"]; } else { $className = ucfirst($handlerName); include_once HANDLER_PATH . "/" . $this->getHandlerPath() . $className . ".php"; } $tempClass = new ReflectionClass($className); if ($tempClass->isInstantiable()) { $temp = $tempClass->newInstance(); } if ($temp != NULL) { if ($tempClass->hasMethod("invokeHandler")) { $tpl = new Smarty(); // $tpl->prepare(); self::setSmartyPaths($tpl); // $tpl->testInstall(); exit; $tpl->debugging = Config::get('SMARTY_DEBUG'); $page = new Page(); $view = RudraX::invokeMethodByReflectionClass($tempClass, $temp, 'invokeHandler', array('tpl' => $tpl, 'viewModel' => $tpl, 'user' => $user, 'page' => $page, 'dataModel' => $page->data)); //$view = $temp->invokeHandler($tpl ); if (!isset($view)) { $view = $handlerName; } $tpl->assign('user', $user); $tpl->assign('CONTEXT_PATH', CONTEXT_PATH); $tpl->assign('RESOURCE_PATH', Config::get('RESOURCE_PATH')); if (isset($tpl->repeatData)) { foreach ($tpl->repeatData as $key => $value) { $tpl->assign($value['key'], $value['value']); $tpl->display($this->getViewPath() . $view . Config::get('TEMP_EXT')); } } else { $tpl->display($this->getViewPath() . $view . Config::get('TEMP_EXT')); } echo TEMP_DELIMITER; if (BROWSER_LOGS) { Browser::printlogs(); } echo TEMP_DELIMITER . json_encode($page->data->data); } else { if ($tempClass->hasMethod("invoke")) { $view = $temp->invoke(); if (!isset($view)) { $view = $handlerName; } include $this->getViewPath() . $view . '.php'; } } } }
function init( ){ self::$op = strtolower( getEnvs( 'HTTP_X_OPERAMINI_PHONE' ) ); self::$ua = strtolower( getEnvs( 'HTTP_USER_AGENT' ) ); self::$ac = strtolower( getEnvs( 'HTTP_ACCEPT' ) ); self::$ip = strtolower( getEnvs( 'REMOTE_ADDR' ) ); }
protected function checkBrowsers() { parent::checkBrowsers(); // now add detection for more bots. if (!$this->isRobot()) { $this->bulkCheckRobot(); } }
function YtTemplate($template = null) { $this->_tpl = $template; $this->template = $template->template; $this->type = $this->getType(); $this->browser = $this->browser(); $_params_cookie = array('direction', 'fontsize', 'font_name', 'sitestyle', 'bgcolor', 'linkcolor', 'textcolor', 'header-bgimage', 'header-bgcolor', 'footer-bgcolor', 'footer-bgimage', 'default_main_layout', 'menustyle', 'googleWebFont'); foreach ($_params_cookie as $k) { $this->_params_cookie[$k] = $this->_tpl->params->get($k); } $this->getUserSetting(); //print_r($this->_params_cookie); die(); $browser = new Browser(); $this->is_mobile = $browser->isMobile(); $this->float1 = $this->getParam('direction') == 'rtl' ? 'float:right' : 'float:left'; $this->float2 = $this->getParam('direction') == 'rtl' ? 'float:left' : 'float:right'; }
/** * Returns the stream URL for the media. A direct link will be returned if * the user is on a mobile device or if the "singleFilePlaylist" setting * is enabled, otherwise the media playlist URL will be returned * @return string the stream URL */ protected function getStreamUrl() { if (count($this->_links) === 1 && (Setting::getBoolean('singleFilePlaylist') || (Browser::isMobile() || Browser::isTablet()))) { return $this->_links[0]->url; } else { return $this->getPlayListAction(); } }
/** * Maximizes a window. * * @return WindowList */ public function maximize($name = 'current') { if (null === $name) { $name = 'current'; } $this->browser->request('POST', 'window/' . urlencode($name) . '/maximize'); return $this; }
public static function getBrowser() { if (!self::$browser) { if (!self::isConsole() && isset($_SERVER['HTTP_USER_AGENT'])) { self::$browser = @get_browser(); } } return self::$browser; }