本文整理汇总了PHP中Browser::getUserAgent方法的典型用法代码示例。如果您正苦于以下问题:PHP Browser::getUserAgent方法的具体用法?PHP Browser::getUserAgent怎么用?PHP Browser::getUserAgent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Browser
的用法示例。
在下文中一共展示了Browser::getUserAgent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
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));
}
示例2: detect
/**
* Routine to determine the browser type.
*
* @param Browser $browser
* @param UserAgent $userAgent
*
* @return bool
*/
public static function detect(Browser $browser, UserAgent $userAgent = null)
{
self::$browser = $browser;
if (is_null($userAgent)) {
$userAgent = self::$browser->getUserAgent();
}
self::$userAgentString = $userAgent->getUserAgentString();
self::$browser->setName(Browser::UNKNOWN);
self::$browser->setVersion(Browser::VERSION_UNKNOWN);
self::checkChromeFrame();
foreach (self::$browsersList as $browserName) {
$funcName = self::FUNC_PREFIX . $browserName;
if (self::$funcName()) {
return true;
}
}
return false;
}
示例3: set
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);
}
示例4: _save
/**
* Save data
*
* @param Array $dataForms Data form
* @param Array &$return Return
* @param Array $post Post form
* @param String $submissionsData Submission Data
* @param String $fieldId Field Id
* @param String $dataContentEmail Data content Email
* @param Strig $nameFileByIndentifier Get name Field by Indentifier
* @param String $requiredField required field
* @param String $fileAttach Email File Attach
*
* @return boolean
*/
private function _save($dataForms, &$return, $post, $submissionsData, $dataContentEmail, $nameFileByIndentifier, $requiredField, $fileAttach, $recepientEmail)
{
$user = JFactory::getUser();
$ip = getenv('REMOTE_ADDR');
$country = $this->countryCityFromIP($ip);
$browser = new Browser();
$checkSaveSubmission = true;
$formSettings = !empty($dataForms->form_settings) ? json_decode($dataForms->form_settings) : "";
$plgName = JSNUniformHelper::getPluginUniform();
if (isset($plgName) && !empty($plgName)) {
if (is_array($plgName)) {
foreach ($plgName as $k => $v) {
$v = (array) $v;
$name = form_ . '' . $v['value'];
$data[$v['value']] = $formSettings->{$name};
$data['post'] = $post;
$data['sub'] = $submissionsData;
if ($v['value'] == 'mailchimp') {
if (isset($post['mailchimp_subcriber']) && $post['mailchimp_subcriber'] == 'on') {
JPluginHelper::importPlugin('uniform', $v['value']);
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('saveFrontEnd', array($data));
}
}
}
}
}
if (!empty($formSettings->action_save_submissions) && $formSettings->action_save_submissions == "No") {
$checkSaveSubmission = false;
}
if ($checkSaveSubmission) {
$dateTime = JHtml::_('date', 'now', JText::_('Y-m-d H:i:s'));
$table = JTable::getInstance('JsnSubmission', 'JSNUniformTable');
$table->bind(array('form_id' => (int) $post['form_id'], 'user_id' => $user->id, 'submission_ip' => $ip, 'submission_country' => $country['country'], 'submission_country_code' => $country['country_code'], 'submission_browser' => $browser->getBrowser(), 'submission_browser_version' => $browser->getVersion(), 'submission_browser_agent' => $browser->getUserAgent(), 'submission_os' => $browser->getPlatform(), 'submission_created_by' => $user->id, 'submission_created_at' => $dateTime, 'submission_state' => 1));
if (!$table->store()) {
$return->error = $table->getError();
return false;
}
}
$this->_db->setQuery($this->_db->getQuery(true)->select('*')->from('#__jsn_uniform_templates')->where("form_id = " . (int) $dataForms->form_id));
$dataTemplates = $this->_db->loadObjectList();
$this->_db->setQuery($this->_db->getQuery(true)->select('*')->from('#__jsn_uniform_emails')->where("form_id = " . (int) $dataForms->form_id));
$dataEmails = $this->_db->loadObjectList();
if (count($recepientEmail)) {
$recepientEmail = json_decode($recepientEmail);
foreach ($recepientEmail as $recepient) {
$recepient = explode('|', $recepient);
$emailName = trim($recepient[0]);
$email = trim(end($recepient));
$dataRecepient = (object) array('email_id' => '', 'form_id' => '', 'user_id' => '0', 'email_name' => $emailName, 'email_address' => $email, 'email_state' => '1');
$dataEmails = array_merge($dataEmails, array($dataRecepient));
}
}
$formSubmitter = isset($dataForms->form_submitter) ? json_decode($dataForms->form_submitter) : '';
$checkEmailSubmitter = true;
$defaultSubject = isset($dataForms->form_title) ? $dataForms->form_title : '';
if ($dataTemplates) {
foreach ($dataTemplates as $emailTemplate) {
if (!empty($emailTemplate->template_message)) {
$emailTemplate->template_message = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_message);
} else {
$htmlMessage = array();
if ($dataContentEmail) {
$htmlMessage = $this->_emailTemplateDefault($dataContentEmail, $nameFileByIndentifier, $requiredField);
}
$emailTemplate->template_message = $htmlMessage;
}
$emailTemplate->template_subject = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_subject);
$emailTemplate->template_subject = !empty($emailTemplate->template_subject) ? $emailTemplate->template_subject : $defaultSubject;
$emailTemplate->template_from = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_from);
$emailTemplate->template_reply_to = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_reply_to);
$emailTemplate->template_subject = strip_tags($emailTemplate->template_subject);
$emailTemplate->template_from = strip_tags($emailTemplate->template_from);
$emailTemplate->template_reply_to = strip_tags($emailTemplate->template_reply_to);
if ($emailTemplate->template_notify_to == 0 && count($formSubmitter)) {
$checkEmailSubmitter = false;
$listEmailSubmitter = array();
foreach ($formSubmitter as $item) {
if (!empty($item)) {
$emailSubmitter = new stdClass();
$emailSubmitter->email_address = isset($dataContentEmail[$item]) ? $dataContentEmail[$item] : "";
if (!empty($emailSubmitter->email_address)) {
$listEmailSubmitter[] = $emailSubmitter;
}
}
//.........这里部分代码省略.........
示例5: Browser
template_load_dictionnary('translations.xml');
//
// Login/logout
//
// Saves the URL used to access the website
if (!isset($_SESSION['first_input']) && isset($input['action']) && $input['action'] != 'logout' && $input['action'] != 'login' && $input['action'] != 'client_trace') {
$_SESSION['first_input'] = array_merge($_GET, $_POST);
}
// Saves user's web browser information
if (!isset($_SESSION['browser_name']) || !isset($_SESSION['browser_version']) || !isset($_SESSION['user_os'])) {
Autoloader::register();
$browser = new Browser();
$os = new Os();
$_SESSION['browser_name'] = $browser->getName();
$_SESSION['browser_version'] = $browser->getVersion();
$user_agent = $browser->getUserAgent();
$_SESSION['browser_full'] = $user_agent->getUserAgentString();
$_SESSION['user_os'] = $os->getName();
}
// If we're not logged in, we try to log in or display the login form
if (!user_logged_in()) {
// if the url contains the parameter 'anon' the session is assumed as anonymous
if (isset($input['anon']) && $input['anon'] == true) {
user_anonymous_session();
} else {
if (isset($input['action']) && $input['action'] == 'login') {
// The user continues without any authentication
if (isset($_POST['anonymous_session'])) {
user_anonymous_session();
// The user want to authenticate
} else {
示例6: _save
/**
* Save data
*
* @param Array $dataForms Data form
* @param Array &$return Return
* @param Array $post Post form
* @param String $submissionsData Submission Data
* @param String $fieldId Field Id
* @param String $dataContentEmail Data content Email
* @param Strig $nameFileByIndentifier Get name Field by Indentifier
* @param String $requiredField required field
* @param String $fileAttach Email File Attach
*
* @return boolean
*/
private function _save($dataForms, &$return, $post, $submissionsData, $dataContentEmail, $nameFileByIndentifier, $requiredField, $fileAttach)
{
$user = JFactory::getUser();
$ip = getenv('REMOTE_ADDR');
$country = $this->countryCityFromIP($ip);
$browser = new Browser();
$checkSaveSubmission = true;
$formSettings = !empty($dataForms->form_settings) ? json_decode($dataForms->form_settings) : "";
if (!empty($formSettings->action_save_submissions) && $formSettings->action_save_submissions == "No") {
$checkSaveSubmission = false;
}
if ($checkSaveSubmission) {
$table = JTable::getInstance('Submission', 'JSNUniformTable');
$table->bind(array('form_id' => (int) $post['form_id'], 'user_id' => $user->id, 'submission_ip' => $ip, 'submission_country' => $country['country'], 'submission_country_code' => $country['country_code'], 'submission_browser' => $browser->getBrowser(), 'submission_browser_version' => $browser->getVersion(), 'submission_browser_agent' => $browser->getUserAgent(), 'submission_os' => $browser->getPlatform(), 'submission_created_by' => $user->id, 'submission_created_at' => date('Y-m-d H:i:s'), 'submission_state' => 1));
if (!$table->store()) {
$return->error = $table->getError();
return false;
}
}
$this->_db->setQuery($this->_db->getQuery(true)->select('*')->from('#__jsn_uniform_templates')->where("form_id = " . (int) $dataForms->form_id));
$dataTemplates = $this->_db->loadObjectList();
$this->_db->setQuery($this->_db->getQuery(true)->select('*')->from('#__jsn_uniform_emails')->where("form_id = " . (int) $dataForms->form_id));
$dataEmails = $this->_db->loadObjectList();
$formSubmitter = isset($dataForms->form_submitter) ? json_decode($dataForms->form_submitter) : '';
$checkEmailSubmitter = true;
$defaultSubject = isset($dataForms->form_title) ? $dataForms->form_title . " [" . $dataForms->form_id . "]" : '';
if ($dataTemplates) {
foreach ($dataTemplates as $emailTemplate) {
if (!empty($emailTemplate->template_message)) {
$emailTemplate->template_message = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_message);
} else {
$htmlMessage = array();
if ($dataContentEmail) {
$htmlMessage = $this->_emailTemplateDefault($dataContentEmail, $nameFileByIndentifier, $requiredField);
}
$emailTemplate->template_message = $htmlMessage;
}
$emailTemplate->template_subject = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_subject);
$emailTemplate->template_subject = !empty($emailTemplate->template_subject) ? $emailTemplate->template_subject : $defaultSubject;
$emailTemplate->template_from = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_from);
$emailTemplate->template_reply_to = preg_replace('/\\{\\$([^\\}]+)\\}/ie', '@$dataContentEmail["\\1"]', $emailTemplate->template_reply_to);
$emailTemplate->template_subject = strip_tags($emailTemplate->template_subject);
$emailTemplate->template_from = strip_tags($emailTemplate->template_from);
$emailTemplate->template_reply_to = strip_tags($emailTemplate->template_reply_to);
if ($emailTemplate->template_notify_to == 0 && count($formSubmitter)) {
$checkEmailSubmitter = false;
$listEmailSubmitter = array();
foreach ($formSubmitter as $item) {
if (!empty($item)) {
$emailSubmitter = new stdClass();
$emailSubmitter->email_address = isset($dataContentEmail[$item]) ? $dataContentEmail[$item] : "";
if (!empty($emailSubmitter->email_address)) {
$listEmailSubmitter[] = $emailSubmitter;
}
}
}
$sent = $this->_sendEmailList($emailTemplate, $listEmailSubmitter, $fileAttach);
// Set the success message if it was a success
if (!JError::isError($sent)) {
$msg = JText::_('JSN_UNIFORM_EMAIL_THANKS');
}
}
if ($emailTemplate->template_notify_to == 1) {
$sent = $this->_sendEmailList($emailTemplate, $dataEmails, $fileAttach);
// Set the success message if it was a success
if (!JError::isError($sent)) {
$msg = JText::_('JSN_UNIFORM_EMAIL_THANKS');
}
}
}
}
if ($checkEmailSubmitter && count($formSubmitter)) {
$emailTemplate = new stdClass();
$htmlMessage = array();
if ($dataContentEmail) {
$htmlMessage = $this->_emailTemplateDefault($dataContentEmail, $nameFileByIndentifier, $requiredField);
}
$emailTemplate->template_message = $htmlMessage;
$listEmailSubmitter = array();
foreach ($formSubmitter as $item) {
if (!empty($item)) {
$emailSubmitter = new stdClass();
$emailSubmitter->email_address = isset($dataContentEmail[$item]) ? $dataContentEmail[$item] : "";
if (!empty($emailSubmitter->email_address)) {
$listEmailSubmitter[] = $emailSubmitter;
//.........这里部分代码省略.........
示例7: html
//.........这里部分代码省略.........
$wp_get_export = 'Yes';
$wp_get = '<mark class="ok">' . __('Yes', 'google-calendar-events') . '</mark>';
} else {
$wp_get_export = 'No';
$wp_get = '<mark class="error">' . __('No', 'google-calendar-events');
if (is_wp_error($response)) {
$error = ' (' . $response->get_error_message() . ')';
$wp_get .= $error;
$wp_get_export .= $error;
} else {
$error = ' (' . $response['response']['code'] . ')';
$wp_get .= $error;
$wp_get_export .= $error;
}
$wp_get .= '</mark>';
}
$php_memory_limit = ini_get('memory_limit');
$php_max_upload_filesize = ini_get('upload_max_filesize');
$php_post_max_size = ini_get('post_max_size');
$php_max_execution_time = ini_get('max_execution_time');
$php_max_input_vars = ini_get('max_input_vars');
$sections['server'] = array('host' => array('label' => __('Web Server', 'google-calendar-events'), 'label_export' => 'Web Server', 'result' => $host), 'php_version' => array('label' => __('PHP Version', 'google-calendar-events'), 'label_export' => 'PHP Version', 'result' => $php, 'result_export' => PHP_VERSION), 'mysql_version' => array('label' => __('MySQL Version', 'google-calendar-events'), 'label_export' => 'MySQL Version', 'result' => version_compare($mysql, '5.5', '>') ? '<mark class="ok">' . $mysql . '</mark>' : $mysql, 'result_export' => $mysql), 'server_timezone' => array('label' => __('Server Timezone', 'google-calendar-events'), 'label_export' => 'Server Timezone', 'result' => $server_timezone, 'result_export' => $server_timezone_export), 'display_errors' => array('label' => 'Display Errors', 'result' => ini_get('display_errors') ? __('Yes', 'google-calendar-events') . ' (' . ini_get('display_errors') . ')' : '-', 'result_export' => ini_get('display_errors') ? 'Yes' : 'No'), 'php_safe_mode' => array('label' => 'Safe Mode', 'result' => ini_get('safe_mode') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), 'result_export' => ini_get('safe_mode') ? 'Yes' : 'No'), 'php_memory_limit' => array('label' => 'Memory Limit', 'result' => $php_memory_limit ? $php_memory_limit : '-'), 'upload_max_filesize' => array('label' => 'Upload Max Filesize', 'result' => $php_max_upload_filesize ? $php_max_upload_filesize : '-'), 'post_max_size' => array('label' => 'Post Max Size', 'result' => $php_post_max_size ? $php_post_max_size : '-'), 'max_execution_time' => array('label' => 'Max Execution Time', 'result' => $php_max_execution_time ? $php_max_execution_time : '-'), 'max_input_vars' => array('label' => 'Max Input Vars', 'result' => $php_max_input_vars ? $php_max_input_vars : '-'), 'fsockopen' => array('label' => 'fsockopen', 'result' => function_exists('fsockopen') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), 'result_export' => function_exists('fsockopen') ? 'Yes' : 'No'), 'curl_init' => array('label' => 'cURL', 'result' => function_exists('curl_init') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), 'result_export' => function_exists('curl_init') ? 'Yes' : 'No'), 'soap' => array('label' => 'SOAP', 'result' => class_exists('SoapClient') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), 'result_export' => class_exists('SoapClient') ? 'Yes' : 'No'), 'suhosin' => array('label' => 'SUHOSIN', 'result' => extension_loaded('suhosin') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), 'result_export' => extension_loaded('suhosin') ? 'Yes' : 'No'), 'wp_remote_post' => array('label' => 'WP Remote POST', 'result' => $wp_post, 'result_export' => $wp_post_export), 'wp_remote_get' => array('label' => 'WP Remote GET', 'result' => $wp_get, 'result_export' => $wp_get_export));
/**
* Client Information
* ==================
*/
$user_client = new \Browser();
$browser = '<dl>';
$browser .= '<dt>' . __('Name:', 'google-calendar-events') . '</dt>';
$browser .= '<dd>' . $user_client->getBrowser() . '</dd>';
$browser .= '<dt>' . __('Version:', 'google-calendar-events') . '</dt>';
$browser .= '<dd>' . $user_client->getVersion() . '</dd>';
$browser .= '<dt>' . __('User Agent:', 'google-calendar-events') . '</dt>';
$browser .= '<dd>' . $user_client->getUserAgent() . '</dd>';
$browser .= '<dt>' . __('Platform:', 'google-calendar-events') . '</dt>';
$browser .= '<dd>' . $user_client->getPlatform() . '</dd>';
$browser .= '</dl>';
$browser_export = $user_client->getBrowser() . ' ' . $user_client->getVersion() . ' (' . $user_client->getPlatform() . ')';
$sections['client'] = array('user_ip' => array('label' => __('IP Address', 'google-calendar-events'), 'label_export' => 'IP Address', 'result' => $_SERVER['SERVER_ADDR']), 'browser' => array('label' => __('Browser', 'google-calendar-events'), 'result' => $browser, 'result_export' => $browser_export));
/**
* Final Output
* ============
*/
$panels = apply_filters('simcal_system_status_report_panels', $panels);
$sections = apply_filters('simcal_system_status_report_sections', $sections);
foreach ($panels as $panel => $v) {
if (isset($sections[$panel])) {
?>
<table class="widefat simcal-system-status-report-panel">
<thead class="<?php
echo $panel;
?>
">
<tr>
<th colspan="3" data-export="<?php
echo $v['export'];
?>
"><?php
echo $v['label'];
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($sections[$panel] as $row => $cell) {
示例8: Browser
if (!$ttl) {
$ttl = 'No title';
}
$ttl = $ExternalCounters->prepare_str(str_replace(" ", "+", $ttl));
$encoding = $ExternalCounters->get_query_param('encoding');
$ttl = $ExternalCounters->fix_ttl_encoding($encoding, $ttl, $rfrr);
$is_robot = '';
$ua = '';
$ua_str = '';
$ua_version = '';
$os = '';
if (!isset($browser) || empty($browser)) {
$browser = new Browser();
$is_robot = $browser->isRobot() ? $browser->getBrowser() : '';
$ua = $browser->getBrowser() ? $browser->getBrowser() : '';
$ua_str = $browser->getUserAgent() ? $browser->getUserAgent() : 'unknown';
$ua_version = $browser->getVersion() ? $browser->getVersion() : '';
$os = $browser->getPlatform() ? $browser->getPlatform() : '';
}
$table_name = $pt_externalcounters_table_name;
$DBH->exec("CREATE TABLE IF NOT EXISTS `" . $table_name . "` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `adddate` int(11) DEFAULT NULL, `random` varchar(50) DEFAULT NULL, `user_login` mediumtext NOT NULL, `referer` mediumtext NOT NULL, `self` mediumtext NOT NULL, `page_title` mediumtext NOT NULL, `browser` mediumtext NOT NULL, `number` mediumtext NOT NULL, `os` mediumtext NOT NULL, `os_number` mediumtext NOT NULL, `host` mediumtext NOT NULL, `ip` mediumtext NOT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `page_title` (`page_title`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
if (!$is_robot) {
try {
/**
* if table exists
*/
if ($ExternalCounters->db_table_exists($DBH, $table_name)) {
$SQL = "INSERT INTO `" . $table_name . "` ";
$SQL .= "(`adddate`, `random`, `user_login`, `referer`, `self`, `page_title`, `browser`, `number`, `os`, `os_number`, `host`, `ip`) ";
//$SQL .= "VALUES (?,?,?,?,?,?,?,?,?,?,?,?);";
$SQL .= "VALUES (:adddate, :random, :user_login, :referer, :self, :page_title, :browser, :number, :os, :os_number, :host, :ip);";
示例9: get_status
/**
* Get status
* Credits to @link(https://github.com/reduxframework/redux-framework/blob/master/ReduxCore/inc/class.redux_helpers.php#L367)
*
* @since 1.0.0
* @global $wpdb | WordPress database object
* @param boolean $output_as_json
* @param boolean $remote_checks
* @return array
*/
public static function get_status($output_as_json = false, $remote_checks = true)
{
global $wpdb;
$data = array();
// WordPress
$data['home_url'] = home_url();
$data['site_url'] = site_url();
$data['wp_content_url'] = WP_CONTENT_URL;
$data['wp_ver'] = get_bloginfo('version');
$data['wp_multisite'] = is_multisite();
$data['permalink_structure'] = get_option('permalink_structure') ? get_option('permalink_structure') : 'Default';
$data['front_page_display'] = get_option('show_on_front');
if ($data['front_page_display'] == 'page') {
$front_page_id = get_option('page_on_front');
$blog_page_id = get_option('page_for_posts');
$data['front_page'] = $front_page_id != 0 ? get_the_title($front_page_id) . ' (#' . $front_page_id . ')' : 'Unset';
$data['posts_page'] = $blog_page_id != 0 ? get_the_title($blog_page_id) . ' (#' . $blog_page_id . ')' : 'Unset';
}
$data['wp_mem_limit_raw'] = self::let_to_num(WP_MEMORY_LIMIT);
$data['wp_mem_limit_size'] = size_format($data['wp_mem_limit_raw']);
$data['db_table_prefix'] = 'Length: ' . strlen($wpdb->prefix) . ' - Status: ' . (strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable');
$data['wp_debug'] = 'false';
if (defined('WP_DEBUG') && WP_DEBUG) {
$data['wp_debug'] = 'true';
}
$data['wp_lang'] = get_locale();
// server
$data['server_info'] = esc_html($_SERVER['SERVER_SOFTWARE']);
$data['localhost'] = self::bool_to_string(self::is_local_host());
$data['php_ver'] = function_exists('phpversion') ? esc_html(phpversion()) : 'phpversion() function does not exist.';
$data['abspath'] = ABSPATH;
if (function_exists('ini_get')) {
$data['php_mem_limit'] = size_format(self::let_to_num(ini_get('memory_limit')));
$data['php_post_max_size'] = size_format(self::let_to_num(ini_get('post_max_size')));
$data['php_time_limit'] = ini_get('max_execution_time');
$data['php_max_input_var'] = ini_get('max_input_vars');
$data['php_display_errors'] = self::bool_to_string(ini_get('display_errors'));
}
$data['suhosin_installed'] = extension_loaded('suhosin');
$data['mysql_ver'] = $wpdb->db_version();
$data['max_upload_size'] = size_format(wp_max_upload_size());
$data['def_tz_is_utc'] = 'true';
if (date_default_timezone_get() !== 'UTC') {
$data['def_tz_is_utc'] = 'false';
}
$data['fsockopen_curl'] = 'false';
if (function_exists('fsockopen') || function_exists('curl_init')) {
$data['fsockopen_curl'] = 'true';
}
// remote
if ($remote_checks == true) {
$response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', array('sslverify' => false, 'timeout' => 60, 'body' => array('cmd' => '_notify-validate')));
if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
$data['wp_remote_post'] = 'true';
$data['wp_remote_post_error'] = '';
} else {
$data['wp_remote_post'] = 'false';
$data['wp_remote_post_error'] = $response->get_error_message();
}
}
// custom
$custom_key = apply_filters('PWP_System_Status\\custom_key', 'custom');
$custom_array = apply_filters('PWP_System_Status\\custom_array', array());
$data[$custom_key] = $custom_array;
// $data['redux_ver'] = esc_html( ReduxFramework::$_version );
// $data['redux_data_dir'] = ReduxFramework::$_upload_dir;
// Only is a file-write check
// $f = 'fo' . 'pen';
// $data['redux_data_writeable'] = self::bool_to_string( @$f( ReduxFramework::$_upload_dir . 'test-log.log', 'a' ) );
// browser
if (!class_exists('Browser')) {
require_once __DIR__ . '/Browser.php';
// require_once __DIR__ . '/vendor/cbschuld/browser.php/lib/Browser.php'; // @@todo \\
}
$browser = new Browser();
$data['browser']['agent'] = $browser->getUserAgent();
$data['browser']['browser'] = $browser->getBrowser();
$data['browser']['version'] = $browser->getVersion();
$data['browser']['platform'] = $browser->getPlatform();
$data['browser']['mobile'] = $browser->isMobile() ? 'true' : 'false';
// theme
$active_theme = wp_get_theme();
$data['theme']['name'] = $active_theme->Name;
$data['theme']['version'] = $active_theme->Version;
$data['theme']['author_uri'] = $active_theme->{'Author URI'};
$data['theme']['is_child'] = self::bool_to_string(is_child_theme());
if (is_child_theme()) {
$parent_theme = wp_get_theme($active_theme->Template);
$data['theme']['parent_name'] = $parent_theme->Name;
$data['theme']['parent_version'] = $parent_theme->Version;
//.........这里部分代码省略.........
示例10: set_content
//.........这里部分代码省略.........
} else {
$wp_get_export = 'No';
$wp_get = '<mark class="error">' . __('No', 'gce');
if (is_wp_error($response)) {
$error = ' (' . $response->get_error_message() . ')';
$wp_get .= $error;
$wp_get_export .= $error;
} else {
$error = ' (' . $response['response']['code'] . ')';
$wp_get .= $error;
$wp_get_export .= $error;
}
$wp_get .= '</mark>';
}
$php_memory_limit = ini_get('memory_limit');
$php_max_upload_filesize = ini_get('upload_max_filesize');
$php_post_max_size = ini_get('post_max_size');
$php_max_execution_time = ini_get('max_execution_time');
$php_max_input_vars = ini_get('max_input_vars');
$sections['server'] = array('host' => array('label' => __('Web Server', 'sc'), 'label_export' => 'Web Server', 'result' => $host), 'php_version' => array('label' => __('PHP Version', 'sc'), 'label_export' => 'PHP Version', 'result' => $php, 'result_export' => PHP_VERSION), 'mysql_version' => array('label' => __('MySQL Version', 'sc'), 'label_export' => 'MySQL Version', 'result' => version_compare($mysql, '5.5', '>') ? '<mark class="ok">' . $mysql . '</mark>' : $mysql, 'result_export' => $mysql), 'server_timezone' => array('label' => __('Server Timezone', 'sc'), 'label_export' => 'Server Timezone', 'result' => $server_timezone, 'result_export' => $server_timezone_export), 'display_errors' => array('label' => __('Display Errors', 'sc'), 'result' => ini_get('display_errors') ? __('Yes', 'sc') . ' (' . ini_get('display_errors') . ')' : '-', 'result_export' => ini_get('display_errors') ? 'Yes' : 'No'), 'php_safe_mode' => array('label' => __('Safe Mode', 'sc'), 'result' => ini_get('safe_mode') ? __('Yes', 'sc') : __('No', 'sc'), 'result_export' => ini_get('safe_mode') ? 'Yes' : 'No'), 'php_memory_limit' => array('label' => __('Memory Limit', 'sc'), 'result' => $php_memory_limit ? $php_memory_limit : '-'), 'upload_max_filesize' => array('label' => __('Upload Max Filesize', 'sc'), 'result' => $php_max_upload_filesize ? $php_max_upload_filesize : '-'), 'post_max_size' => array('label' => __('Post Max Size', 'sc'), 'result' => $php_post_max_size ? $php_post_max_size : '-'), 'max_execution_time' => array('label' => __('Max Execution Time', 'sc'), 'result' => $php_max_execution_time ? $php_max_execution_time : '-'), 'max_input_vars' => array('label' => __('Max Input Vars', 'sc'), 'result' => $php_max_input_vars ? $php_max_input_vars : '-'), 'fsockopen' => array('label' => 'fsockopen', 'result' => function_exists('fsockopen') ? __('Yes', 'sc') : __('No', 'sc'), 'result_export' => function_exists('fsockopen') ? 'Yes' : 'No'), 'curl_init' => array('label' => 'cURL', 'result' => function_exists('curl_init') ? __('Yes', 'sc') : __('No', 'sc'), 'result_export' => function_exists('curl_init') ? 'Yes' : 'No'), 'soap' => array('label' => 'SOAP', 'result' => class_exists('SoapClient') ? __('Yes', 'sc') : __('No', 'sc'), 'result_export' => class_exists('SoapClient') ? 'Yes' : 'No'), 'suhosin' => array('label' => 'SUHOSIN', 'result' => extension_loaded('suhosin') ? __('Yes', 'sc') : __('No', 'sc'), 'result_export' => extension_loaded('suhosin') ? 'Yes' : 'No'), 'wp_remote_post' => array('label' => __('WP Remote POST', 'sc'), 'result' => $wp_post, 'result_export' => $wp_post_export), 'wp_remote_get' => array('label' => __('WP Remote GET', 'sc'), 'result' => $wp_get, 'result_export' => $wp_get_export));
/**
* Client Information
* ==================
*/
if (!class_exists('Browser')) {
include_once SC_DIR_PATH . 'libraries/browser-php/Browser.php';
$user_client = new \Browser();
$browser = '<dl>';
$browser .= '<dt>' . __('Name:', 'sc') . '</dt>';
$browser .= '<dd>' . $user_client->getBrowser() . '</dd>';
$browser .= '<dt>' . __('Version:', 'sc') . '</dt>';
$browser .= '<dd>' . $user_client->getVersion() . '</dd>';
$browser .= '<dt>' . __('User Agent:', 'sc') . '</dt>';
$browser .= '<dd>' . $user_client->getUserAgent() . '</dd>';
$browser .= '<dt>' . __('Platform:', 'sc') . '</dt>';
$browser .= '<dd>' . $user_client->getPlatform() . '</dd>';
$browser .= '</dl>';
$browser_export = $user_client->getBrowser() . ' ' . $user_client->getVersion() . ' (' . $user_client->getPlatform() . ')';
} else {
$browser = '<dl>';
$browser .= '<dt>' . __('User Agent:', 'sc') . '</dt>';
$browser .= '<dd>' . $_SERVER['HTTP_USER_AGENT'] . '</dd>';
$browser .= '</dl>';
$browser_export = $_SERVER['HTTP_USER_AGENT'];
}
$sections['client'] = array('user_ip' => array('label' => __('IP Address', 'sc'), 'label_export' => 'IP Address', 'result' => $_SERVER['SERVER_ADDR']), 'browser' => array('label' => __('Browser', 'sc'), 'result' => $browser, 'result_export' => $browser_export));
/**
* Final Output
* ============
*/
$panels = apply_filters('sc_system_status_report_panels', $panels);
$sections = apply_filters('sc_system_status_report_sections', $sections);
foreach ($panels as $panel => $v) {
if (isset($sections[$panel])) {
?>
<table class="widefat sc-system-status-report-panel">
<thead class="<?php
echo $panel;
?>
">
<tr>
<th colspan="3" data-export="<?php
echo $v['export'];
?>
"><?php
echo $v['label'];
示例11: checkloginAction
function checkloginAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
$session = SessionWrapper::getInstance();
$formvalues = $this->_getAllParams();
// debugMessage($formvalues);
# check that an email has been provided
if (isEmptyString(trim($this->_getParam("email")))) {
$session->setVar(ERROR_MESSAGE, $this->_translate->translate("profile_email_error"));
$session->setVar(FORM_VALUES, $this->_getAllParams());
// return to the home page
$this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
}
if (isEmptyString(trim($this->_getParam("password")))) {
$session->setVar(ERROR_MESSAGE, $this->_translate->translate("profile_password_error"));
$session->setVar(FORM_VALUES, $this->_getAllParams());
// return to the home page
$this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
}
# check which field user is using to login. default is username
$credcolumn = "username";
$login = (string) trim($this->_getParam("email"));
// $password = encode(sha1(trim($this->_getParam("password"))));
# check if credcolumn is emai
$validator = new Zend_Validate_EmailAddress();
if ($validator->isValid($login)) {
$usertable = new UserAccount();
if ($usertable->findByEmail($login)) {
$credcolumn = 'email';
}
}
if (stringContains('!@#', $login)) {
$credcolumn = 'trx';
$loginarray = explode('.', $login);
// debugMessage($loginarray);
$id = $loginarray[0];
}
// debugMessage($credcolumn); exit;
$browser = new Browser();
$audit_values = $browser_session = array("browserdetails" => $browser->getBrowserDetailsForAudit(), "browser" => $browser->getBrowser(), "version" => $browser->getVersion(), "useragent" => $browser->getUserAgent(), "os" => $browser->getPlatform(), "ismobile" => $browser->isMobile() ? '1' : 0, "ipaddress" => $browser->getIPAddress());
// debugMessage($audit_values);
if ($credcolumn == 'email' || $credcolumn == 'username') {
$authAdapter = new Zend_Auth_Adapter_DbTable(Zend_Registry::get("dbAdapter"));
// define the table, fields and additional rules to use for authentication
$authAdapter->setTableName('useraccount');
$authAdapter->setIdentityColumn($credcolumn);
$authAdapter->setCredentialColumn('password');
$authAdapter->setCredentialTreatment("sha1(?) AND status = '1' ");
// set the credentials from the login form
$authAdapter->setIdentity($login);
$authAdapter->setCredential($this->_getParam("password"));
// new class to audit the type of Browser and OS that the visitor is using
if (!$authAdapter->authenticate()->isValid()) {
// debugMessage('invalid'); exit;
// add failed login to audit trail
$audit_values['module'] = 1;
$audit_values['usecase'] = '1.1';
$audit_values['transactiontype'] = USER_LOGIN;
$audit_values['status'] = "N";
$audit_values['transactiondetails'] = "Login for user with id '" . $this->_getParam("email") . "' failed. Invalid username or password";
// exit();
$this->notify(new sfEvent($this, USER_LOGIN, $audit_values));
// return to the home page
if (!isArrayKeyAnEmptyString(URL_FAILURE, $formvalues)) {
$session->setVar(ERROR_MESSAGE, "Invalid Email or Username or Password. <br />Please Try Again.");
$this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
} else {
$session->setVar(ERROR_MESSAGE, "Invalid Email or Username or Password. <br />Please Try Again.");
$this->_helper->redirector->gotoSimple('login', "user");
}
return false;
}
// user is logged in sucessfully so add information to the session
$user = $authAdapter->getResultRowObject();
$useraccount = new UserAccount();
$useraccount->populate($user->id);
}
// exit;
# trx login
if ($credcolumn == 'trx') {
$useraccount = new UserAccount();
$useraccount->populate($id);
// debugMessage($result); exit();
if (isEmptyString($useraccount->getID())) {
// return to the home page
if (!isArrayKeyAnEmptyString(URL_FAILURE, $formvalues)) {
$session->setVar(ERROR_MESSAGE, "Invalid Email or Username or Password. <br />Please Try Again.");
$this->_helper->redirector->gotoUrl(decode($this->_getParam(URL_FAILURE)));
} else {
$session->setVar(ERROR_MESSAGE, "Invalid Email or Username or Password. <br />Please Try Again.");
$this->_helper->redirector->gotoSimple('login', "user");
}
return false;
}
}
// debugMessage($useraccount->toArray()); exit();
$session->setVar("userid", $useraccount->getID());
$session->setVar("username", $useraccount->getUserName());
$session->setVar("type", $useraccount->getType());
//.........这里部分代码省略.........
示例12: render_page
/**
* Render the diagnostics page (adapted from https://github.com/WordImpress/Give/blob/master/includes/admin/system-info.php)
*/
function render_page()
{
global $wpdb;
$browser = new \Browser();
?>
<div class="wrap">
<h1><?php
_e('Diagnostics', 'pressbooks');
?>
</h1>
<p><?php
_e('Please submit this information with any bug reports.', 'pressbooks');
?>
</p>
<textarea style="width: 800px; max-width: 100%; height: 600px; background: #fff; font-family: monospace;" readonly="readonly" onclick="this.focus(); this.select()" title="<?php
_e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'pressbooks');
?>
">
<?php
$output = "### System Information\n\n";
$output .= "#### Book Info\n\n";
$output .= 'Book ID: ' . get_current_blog_id() . "\n";
$output .= 'Book URL: ' . trailingslashit(get_bloginfo('url')) . "\n";
$output .= 'Book Privacy: ' . (get_bloginfo('blog_public') ? 'Public' : 'Private') . "\n\n";
$output .= "#### Browser\n\n";
$output .= 'Platform: ' . str_replace('mac', 'Mac', $browser->getPlatform()) . "\n";
$output .= 'Browser Name: ' . $browser->getBrowser() . "\n";
$output .= 'Browser Version: ' . $browser->getVersion() . "\n";
$output .= 'User Agent String: ' . $browser->getUserAgent() . "\n\n";
$output .= '#### WordPress Configuration' . "\n\n";
$output .= 'Network URL: ' . network_home_url() . "\n";
$output .= 'Network Type: ' . (is_subdomain_install() ? 'Subdomain' : 'Subdirectory') . "\n";
$output .= 'Version: ' . get_bloginfo('version') . "\n";
$output .= 'Language: ' . (defined('WPLANG') && WPLANG ? WPLANG : 'en_US') . "\n";
$output .= 'WP_ENV: ' . (defined('WP_ENV') ? WP_ENV : 'Not set') . "\n";
$output .= 'WP_DEBUG: ' . (defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set') . "\n";
$output .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n\n";
$output .= "#### Pressbooks Configuration\n\n";
$output .= 'Version: ' . PB_PLUGIN_VERSION . "\n";
$theme = wp_get_theme();
switch_to_blog($GLOBALS['current_site']->blog_id);
$root_theme = wp_get_theme();
restore_current_blog();
$output .= 'Book Theme: ' . $theme->get('Name') . "\n";
$output .= 'Book Theme Version: ' . $theme->get('Version') . "\n";
$output .= 'Root Theme: ' . $root_theme->get('Name') . "\n";
$output .= 'Root Theme Version: ' . $root_theme->get('Version') . "\n\n";
$output .= "#### Pressbooks Dependencies\n\n";
$output .= 'Epubcheck: ' . (\Pressbooks\Utility\check_epubcheck_install() ? 'Installed' : 'Not Installed') . "\n";
// TODO: version
$output .= 'Kindlegen: ' . (\Pressbooks\Utility\check_kindlegen_install() ? 'Installed' : 'Not Installed') . "\n";
// TODO: version
$output .= 'xmllint: ' . (\Pressbooks\Utility\check_xmllint_install() ? 'Installed' : 'Not Installed') . "\n";
// TODO: version
$output .= 'PrinceXML: ' . (\Pressbooks\Utility\check_prince_install() ? 'Installed' : 'Not Installed') . "\n";
// TODO: version
$output .= 'Saxon-HE: ' . (\Pressbooks\Utility\check_saxonhe_install() ? 'Installed' : 'Not Installed') . "\n\n";
// TODO: version
$muplugins = get_mu_plugins();
if (count($muplugins > 0)) {
$output .= '#### Must-Use Plugins' . "\n\n";
foreach ($muplugins as $plugin => $plugin_data) {
$output .= $plugin_data['Name'] . ': ' . ($plugin_data['Version'] ? $plugin_data['Version'] : 'n/a') . "\n";
}
}
$output .= "\n#### Network Active Plugins\n\n";
$plugins = get_plugins();
$network_active_plugins = get_site_option('active_sitewide_plugins', array());
foreach ($plugins as $plugin_path => $plugin) {
if (!array_key_exists($plugin_path, $network_active_plugins)) {
continue;
}
$output .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
}
$output .= "\n#### Book Active Plugins\n\n";
$plugins = get_plugins();
$active_plugins = get_option('active_plugins', array());
foreach ($plugins as $plugin_path => $plugin) {
if (!in_array($plugin_path, $active_plugins)) {
continue;
}
$output .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
}
$output .= "\n#### Inactive Plugins\n\n";
foreach ($plugins as $plugin_path => $plugin) {
if (array_key_exists($plugin_path, $network_active_plugins) || in_array($plugin_path, $active_plugins)) {
continue;
}
$output .= $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
}
$output .= "\n#### Server Configuration\n\n";
$output .= 'PHP Version: ' . PHP_VERSION . "\n";
$output .= 'MySQL Version: ' . $wpdb->db_version() . "\n";
$output .= 'Webserver Info: ' . $_SERVER['SERVER_SOFTWARE'] . "\n\n";
$output .= "#### PHP Configuration\n\n";
$output .= 'Safe Mode: ' . (ini_get('safe_mode') ? 'Enabled' : 'Disabled' . "\n");
$output .= 'Memory Limit: ' . ini_get('memory_limit') . "\n";
//.........这里部分代码省略.........
示例13: Browser
document.getElementById('alert_content').innerHTML = 'Attempting to send now...';
}
</script>
</head>
<body onload='login_form.u.focus()'>
<?php
//pull in alert
include "includes/alert.php";
//pull in browser script
include "includes/browser.php";
//put browser info into variable
$browser = new Browser();
//firefox check
if ($browser->getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() <= 7) {
echo "\n <div id=\"browser_warning\">Your browser's user agent is <i>" . $browser->getUserAgent() . "</i><br />From this information we can determine you are running an older version of Firefox (v" . $browser->getVersion() . ") that has not been tested...Please update to the latest version of Firefox for maximum compatibility.</div>";
}
//chrome check
if ($browser->getBrowser() == Browser::BROWSER_CHROME && $browser->getVersion() <= 14) {
echo "\n <div id=\"browser_warning\">Your browser's user agent is <i>" . $browser->getUserAgent() . "</i><br />From this information we can determine you are running an older version of Chrome (v" . $browser->getVersion() . ") that has not been tested...Please update to the latest version for maximum compatibility.</div>";
}
//ie check
if ($browser->getBrowser() == Browser::BROWSER_IE && $browser->getVersion() <= 8.9) {
echo "\n <div id=\"browser_warning\">Your browser's user agent is <i>" . $browser->getUserAgent() . "</i><br />From this information we can determine you are running an older version of Internet Explorer (v" . $browser->getVersion() . ") that has not been tested...Please update to the latest version for maximum compatibility.</div>";
}
if ($browser->getBrowser() != Browser::BROWSER_IE && $browser->getBrowser() != Browser::BROWSER_CHROME && $browser->getBrowser() != Browser::BROWSER_FIREFOX) {
echo "\n <div id=\"browser_warning\">Your browser's user agent is <i>" . $browser->getUserAgent() . "</i><br />From this information we can determine you are running a web browser that has not been tested. Try the latest version of <a href=\"http://google.com/chrome\" target=\"_blank\">Google Chrome</a>, <a href=\"http://microsoft.com/ie\" target=\"_blank\">Microsoft Internet Explorer</a> or <a href=\"http://mozilla.org/firefox\" target=\"_blank\">Mozilla Firefox to ensure maximum compatibility.</a></div>";
}
//look for login errors
if (isset($_SESSION['alert_message'])) {
//create alert popover
示例14: create
/**
*
* @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);
}
示例15:
if (!$d) {
$did = db_insert(TBL_PREFIX . TBL_DOMAINS, "domain", "'" . $domain . "'");
} else {
$did = $d['id'];
}
/* create database entry ---------------------------------------------------- */
$fields = "client_id,cache_id,domain_id,os_id,browser_id,browser_ver,user_agent,";
$fields .= "ftu,ip,scr_width,scr_height,vp_width,vp_height,";
$fields .= "sess_date,sess_time,fps,coords_x,coords_y,clicks,hovered,clicked";
$values = "'" . $_POST['client'] . "',";
$values .= "'" . $cache_id . "',";
$values .= "'" . $did . "',";
$values .= "'" . $osid . "',";
$values .= "'" . $browserid . "',";
$values .= "'" . (double) $browser->getVersion() . "',";
$values .= "'" . $browser->getUserAgent() . "',";
$values .= "'" . (int) $_POST['ftu'] . "',";
$values .= "'" . get_ip() . "',";
$values .= "'" . (int) $_POST['screenw'] . "',";
$values .= "'" . (int) $_POST['screenh'] . "',";
$values .= "'" . (int) $_POST['pagew'] . "',";
$values .= "'" . (int) $_POST['pageh'] . "',";
$values .= "NOW(),";
$values .= "'" . (double) $_POST['time'] . "',";
$values .= "'" . (int) $_POST['fps'] . "',";
$values .= "'" . $_POST['xcoords'] . "',";
$values .= "'" . $_POST['ycoords'] . "',";
$values .= "'" . $_POST['clicks'] . "',";
$values .= "'" . array_sanitize($_POST['elhovered']) . "',";
$values .= "'" . array_sanitize($_POST['elclicked']) . "'";
$uid = db_insert(TBL_PREFIX . TBL_RECORDS, $fields, $values);