Changeset 2215875
- Timestamp:
- 12/20/2019 05:54:32 PM (6 years ago)
- Location:
- oometrics/trunk/inc
- Files:
-
- 2 edited
-
activity-class.php (modified) (1 diff)
-
session-class.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
oometrics/trunk/inc/activity-class.php
r2215856 r2215875 126 126 { 127 127 // echo $this->table.'ssssss'; 128 if($settings['main_user'] != $this->act_uid){128 if($settings['main_user'] != get_current_user_id()){ 129 129 global $wpdb; 130 130 $wpdb->insert($this->table,$data); -
oometrics/trunk/inc/session-class.php
r2215856 r2215875 150 150 } 151 151 } 152 session_start();153 152 $random_number = mt_rand(1111111,99999999); 154 153 $this->ses_hash = wp_hash($now.$random_number); 155 154 // $this->ses_hash = wp_get_session_token(); 156 $_SESSION['oometrics_ses_id'] = $this->ses_hash;157 158 155 if($this->db_exists()){ 159 156 $this->ses_hash = wp_hash($now.$random_number.'x'.$now); 160 $_SESSION['oometrics_ses_id'] = $this->ses_hash;161 157 } 162 158 $this->add(); … … 249 245 return false; 250 246 } 251 247 252 248 // check if a session is stored in database for cart manipulation at the begining 253 249 public function woo_session(){ 254 if ( null === WC()->session ) { 255 $session_class = apply_filters( 'woocommerce_session_handler', 'WC_Session_Handler' ); 256 WC()->session = new $session_class(); 257 WC()->session->init(); 258 WC()->session->set_customer_session_cookie( true ); 259 } else { 260 WC()->session->set_customer_session_cookie( true ); 261 } 262 } 263 250 WC()->session->set_customer_session_cookie( true ); 251 } 252 264 253 public function add(){ 265 254 $this->woo_session(); … … 428 417 $wpdb->prepare( 429 418 "DELETE FROM $this->table 430 WHERE ses_value <= '%d' && ses_date < '%d'",431 array(0,$ now - 20)419 WHERE ses_value <= '%d' &&ses_uid != '%d' && ses_date < '%d'", 420 array(0,$settings['main_user'],$now - 30) 432 421 ) 433 422 );
Note: See TracChangeset
for help on using the changeset viewer.