Changeset 3027984
- Timestamp:
- 01/29/2024 05:01:56 AM (2 years ago)
- File:
-
- 1 edited
-
taggbox-widget/trunk/taggbox.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
taggbox-widget/trunk/taggbox.php
r2998771 r3027984 28 28 if (!defined('TAGGBOX_PLUGIN_SOCIAL_LOGIN_CALL_BACK_URL')) 29 29 define('TAGGBOX_PLUGIN_SOCIAL_LOGIN_CALL_BACK_URL', admin_url() . "admin.php?page=taggbox"); 30 31 if (!defined('TAGGBOX_HANDSHAKE_TOKEN')) 32 define('TAGGBOX_HANDSHAKE_TOKEN', "D64wIhvVgTuJ5T0XYzWL7lYKj7uB2bpM6zsZdJpa3iLXBCameD3sjZu1yptjBl3I"); 30 33 /* END CREATE CONSTANT */ 31 34 /* INCLUDE HELPER */ … … 219 222 220 223 /* BEGIN SOCIAL ACCOUNT LOGIN */ 221 if (isset($_GET['code'])) { 222 223 if ($_GET['code'] == 200) { 224 225 if (IsBase64($_POST['response'])) {/* Validate base64 */ 226 $response = unserialize(base64_decode($_POST['response'])); 227 /* SANITIZE RESPONSE */ 228 $response['user_id'] = sanitize_key($response['user_id']); 229 $response['owner'] = sanitize_key($response['owner']); 230 $response['name'] = sanitize_text_field($response['name']); 231 $response['firstName'] = sanitize_text_field($response['firstName']); 232 $response['lastName'] = sanitize_text_field($response['lastName']); 233 $response['emailId'] = sanitize_email($response['emailId']); 234 $response['activeProduct'] = sanitize_key($response['activeProduct']); 235 $response['accessToken'] = $response['accessToken']; 236 $response['collaboratorlist'] = $response['collaboratorlist']; 237 $response = (object) $response; 238 239 if (taggbox_login($response) == true) { 240 241 header('Location: ' . TAGGBOX_PLUGIN_REDIRECT_URL . 'taggbox'); 242 exit(); 243 } 244 } else { 245 header('Location: ' . TAGGBOX_PLUGIN_REDIRECT_URL . 'taggbox&error=social-login-error'); 224 if (isset($_GET['code']) && $_GET['code'] == 200 && $_POST['token']==TAGGBOX_HANDSHAKE_TOKEN) { 225 226 if (isset($_POST['response'])) {/* Validate base64 */ 227 //$response = unserialize(base64_decode($_POST['response'])); 228 $decoded_data = base64_decode($_POST['response']); 229 230 // Decode JSON 231 $response = json_decode($decoded_data, true); 232 233 /* SANITIZE RESPONSE */ 234 $response['user_id'] = sanitize_key($response['user_id']); 235 $response['owner'] = sanitize_key($response['owner']); 236 $response['name'] = sanitize_text_field($response['name']); 237 $response['firstName'] = sanitize_text_field($response['firstName']); 238 $response['lastName'] = sanitize_text_field($response['lastName']); 239 $response['emailId'] = sanitize_email($response['emailId']); 240 $response['activeProduct'] = sanitize_key($response['activeProduct']); 241 $response['accessToken'] = $response['accessToken']; 242 $response['collaboratorlist'] = $response['collaboratorlist']; 243 $response = (object) $response; 244 245 if (taggbox_login($response) == true) { 246 247 header('Location: ' . TAGGBOX_PLUGIN_REDIRECT_URL . 'taggbox'); 246 248 exit(); 247 249 } … … 250 252 exit(); 251 253 } 254 252 255 } 253 256 /* END SOCIAL ACCOUNT LOGIN */ … … 536 539 $wpdb->query("CREATE TABLE IF NOT EXISTS `wp_taggbox_user` ( 537 540 `id` int(11) NOT NULL AUTO_INCREMENT, 538 `userId` varchar(100) NOT NULL,539 `name` varchar(100) NOT NULL,540 `email` varchar(100) NOT NULL,541 `accessToken` varchar(255) NOT NULL,542 `isLogin` enum('no', 'yes') NOT NULL,543 PRIMARY KEY(`id`)541 `userId` varchar(100) NOT NULL, 542 `name` varchar(100) NOT NULL, 543 `email` varchar(100) NOT NULL, 544 `accessToken` varchar(255) NOT NULL, 545 `isLogin` enum('no', 'yes') NOT NULL, 546 PRIMARY KEY(`id`) 544 547 ) ENGINE = InnoDB DEFAULT CHARSET = latin1"); 545 548 $wpdb->query("CREATE TABLE IF NOT EXISTS `wp_taggbox_collaborator` ( 546 549 `id` int(11) NOT NULL AUTO_INCREMENT, 547 `userId` varchar(100) NOT NULL,548 `collaboratorId` varchar(100) NOT NULL,549 `name` varchar(100) NOT NULL,550 PRIMARY KEY(`id`)550 `userId` varchar(100) NOT NULL, 551 `collaboratorId` varchar(100) NOT NULL, 552 `name` varchar(100) NOT NULL, 553 PRIMARY KEY(`id`) 551 554 ) ENGINE = InnoDB DEFAULT CHARSET = latin1"); 552 555 $wpdb->query("CREATE TABLE IF NOT EXISTS `wp_taggbox_widget` ( 553 556 `id` int(11) NOT NULL AUTO_INCREMENT, 554 `widgetId` varchar(100) NOT NULL,555 `userId` varchar(100) NOT NULL,556 `name` varchar(100) NOT NULL,557 `widgetUrl` varchar(100) NOT NULL,558 `feedCount` varchar(100) NULL,559 `networkCount` varchar(100) NULL,560 `status` int(1) NULL,561 PRIMARY KEY(`id`)557 `widgetId` varchar(100) NOT NULL, 558 `userId` varchar(100) NOT NULL, 559 `name` varchar(100) NOT NULL, 560 `widgetUrl` varchar(100) NOT NULL, 561 `feedCount` varchar(100) NULL, 562 `networkCount` varchar(100) NULL, 563 `status` int(1) NULL, 564 PRIMARY KEY(`id`) 562 565 ) ENGINE = InnoDB DEFAULT CHARSET = latin1"); 563 566 $wpdb->query("CREATE TABLE IF NOT EXISTS `wp_taggbox_active_widget_user` ( 564 567 `id` int(11) NOT NULL AUTO_INCREMENT, 565 568 `userId` varchar(100) NOT NULL, 566 PRIMARY KEY(`id`)569 PRIMARY KEY(`id`) 567 570 ) ENGINE = InnoDB DEFAULT CHARSET = latin1"); 568 571 }
Note: See TracChangeset
for help on using the changeset viewer.