Changeset 2603576
- Timestamp:
- 09/23/2021 11:14:34 AM (5 years ago)
- Location:
- contentstudio
- Files:
-
- 2 edited
- 1 copied
-
tags/1.1.3/trunk (copied) (copied from contentstudio/trunk)
-
tags/1.1.3/trunk/contentstudio-plugin.php (modified) (7 diffs)
-
trunk/contentstudio-plugin.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
contentstudio/tags/1.1.3/trunk/contentstudio-plugin.php
r2534739 r2603576 3 3 Plugin Name: ContentStudio 4 4 Description: ContentStudio provides you with powerful blogging & social media tools to keep your audience hooked by streamlining the process for you to discover and share engaging content on multiple blogging & social media networks 5 Version: 1.1. 25 Version: 1.1.3 6 6 Author: ContentStudio 7 7 Author URI: http://contentstudio.io/ … … 40 40 protected $assets = 'https://contentstudio.io/img'; 41 41 42 private $version = "1.1. 2";42 private $version = "1.1.3"; 43 43 44 44 protected $contentstudio_id = ''; … … 74 74 // register style 75 75 76 if (get_role('subscriber')) {77 remove_role("subscriber");78 }79 76 } 80 77 … … 117 114 { 118 115 116 add_action('init', [$this, 'cstu_verfiy_wp_user']); 119 117 add_action('init', [$this, 'cstu_check_token']); 120 118 add_action('init', [$this, 'cstu_set_token']); … … 460 458 461 459 return false; 460 } 461 462 /** 463 * verify wordpress user 464 */ 465 public function cstu_verfiy_wp_user() 466 { 467 if (isset($_REQUEST['cstu_verfiy_wp_user']) && $_REQUEST['cstu_verfiy_wp_user']) { 468 try { 469 if (isset($_REQUEST['username'], $_REQUEST['password']) && $_REQUEST['username'] && $_REQUEST['password']) { 470 $user = get_user_by('login', $_REQUEST['username']); 471 if ($user && $user->ID != 0) { 472 if (wp_check_password($_REQUEST['password'], $user->data->user_pass, $user->ID)) { 473 if (in_array('administrator', $user->roles) || in_array('editor', $user->roles) || in_array('author', $user->roles)) { 474 echo json_encode(['status' => true, 'message' => 'User verification completed successfully!']); 475 die(); 476 } else { 477 echo json_encode(['status' => false, 'message' => 'Your WordPress user role should be administrator, editor or author.']); 478 die(); 479 } 480 } else { 481 echo json_encode(['status' => false, 'message' => 'The password that you entered is incorrect.']); 482 die(); 483 } 484 } else { 485 echo json_encode(['status' => false, 'message' => 'No user exists with your provided username.']); 486 die(); 487 } 488 } else { 489 echo json_encode(['status' => false, 'message' => 'Invalid request parameters.']); 490 die(); 491 } 492 } catch (Exception $e) { 493 echo json_encode([ 494 'status' => false, 'message' => self::UNKNOWN_ERROR_MESSAGE, 495 'line' => $e->getLine(), 'error_message' => $e->getMessage() 496 ]); 497 } 498 } 462 499 } 463 500 … … 608 645 $valid = $this->do_validate_cstu_token($_REQUEST['token']); 609 646 if ($valid) { 610 $authors = get_users([ ['role__in' => ['editor', 'administrator', 'author']]]);647 $authors = get_users(['role__in' => ['editor', 'administrator', 'author']]); 611 648 $return_authors = []; 612 649 foreach ($authors as $author) { … … 1175 1212 else $filename = basename($image_url); 1176 1213 1177 $modified_filename = s tr_replace(" ","-",$post_title);1214 $modified_filename = sanitize_title($post_title); 1178 1215 if(strpos($filename, '.') === false){ 1179 1216 $filename = $modified_filename . '.png'; -
contentstudio/trunk/contentstudio-plugin.php
r2534739 r2603576 3 3 Plugin Name: ContentStudio 4 4 Description: ContentStudio provides you with powerful blogging & social media tools to keep your audience hooked by streamlining the process for you to discover and share engaging content on multiple blogging & social media networks 5 Version: 1.1. 25 Version: 1.1.3 6 6 Author: ContentStudio 7 7 Author URI: http://contentstudio.io/ … … 40 40 protected $assets = 'https://contentstudio.io/img'; 41 41 42 private $version = "1.1. 2";42 private $version = "1.1.3"; 43 43 44 44 protected $contentstudio_id = ''; … … 74 74 // register style 75 75 76 if (get_role('subscriber')) {77 remove_role("subscriber");78 }79 76 } 80 77 … … 117 114 { 118 115 116 add_action('init', [$this, 'cstu_verfiy_wp_user']); 119 117 add_action('init', [$this, 'cstu_check_token']); 120 118 add_action('init', [$this, 'cstu_set_token']); … … 460 458 461 459 return false; 460 } 461 462 /** 463 * verify wordpress user 464 */ 465 public function cstu_verfiy_wp_user() 466 { 467 if (isset($_REQUEST['cstu_verfiy_wp_user']) && $_REQUEST['cstu_verfiy_wp_user']) { 468 try { 469 if (isset($_REQUEST['username'], $_REQUEST['password']) && $_REQUEST['username'] && $_REQUEST['password']) { 470 $user = get_user_by('login', $_REQUEST['username']); 471 if ($user && $user->ID != 0) { 472 if (wp_check_password($_REQUEST['password'], $user->data->user_pass, $user->ID)) { 473 if (in_array('administrator', $user->roles) || in_array('editor', $user->roles) || in_array('author', $user->roles)) { 474 echo json_encode(['status' => true, 'message' => 'User verification completed successfully!']); 475 die(); 476 } else { 477 echo json_encode(['status' => false, 'message' => 'Your WordPress user role should be administrator, editor or author.']); 478 die(); 479 } 480 } else { 481 echo json_encode(['status' => false, 'message' => 'The password that you entered is incorrect.']); 482 die(); 483 } 484 } else { 485 echo json_encode(['status' => false, 'message' => 'No user exists with your provided username.']); 486 die(); 487 } 488 } else { 489 echo json_encode(['status' => false, 'message' => 'Invalid request parameters.']); 490 die(); 491 } 492 } catch (Exception $e) { 493 echo json_encode([ 494 'status' => false, 'message' => self::UNKNOWN_ERROR_MESSAGE, 495 'line' => $e->getLine(), 'error_message' => $e->getMessage() 496 ]); 497 } 498 } 462 499 } 463 500 … … 608 645 $valid = $this->do_validate_cstu_token($_REQUEST['token']); 609 646 if ($valid) { 610 $authors = get_users([ ['role__in' => ['editor', 'administrator', 'author']]]);647 $authors = get_users(['role__in' => ['editor', 'administrator', 'author']]); 611 648 $return_authors = []; 612 649 foreach ($authors as $author) { … … 1175 1212 else $filename = basename($image_url); 1176 1213 1177 $modified_filename = s tr_replace(" ","-",$post_title);1214 $modified_filename = sanitize_title($post_title); 1178 1215 if(strpos($filename, '.') === false){ 1179 1216 $filename = $modified_filename . '.png';
Note: See TracChangeset
for help on using the changeset viewer.