KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache
System : Linux cs317.bluehost.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : andertr9 ( 1047)
PHP Version : 8.2.18
Disable Function : NONE
Directory :  /opt/eig_wp/wp_install/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/eig_wp/wp_install/includes.php
<?php

function create_wpconf ( $conf_db_name, $conf_db_user, $conf_db_password, $conf_table_prefix ) {
	$config_file = file("wp-config-sample.php");

	foreach( $config_file as &$line ) {
		//echo $line;
		if ( preg_match( '/^define\(\'DB_NAME\',/', $line) ) {
			$line = "define('DB_NAME', '" . $conf_db_name . "');\n";
	
		} elseif ( preg_match( '/^define\(\'DB_USER\',/', $line) ) {
	                $line = "define('DB_USER', '" . $conf_db_user . "');\n";
	
		} elseif ( preg_match( '/^define\(\'DB_PASSWORD\',/', $line) ) {
	                $line = "define('DB_PASSWORD', '" . $conf_db_password . "');\n";
	
		} elseif ( preg_match( '/^\$table_prefix\s+=/', $line) ) {
	                $line = "\$table_prefix  = '$conf_table_prefix';\n";
	
		} elseif ( preg_match( '/^define\(\'(\S+_(KEY|SALT))\'/', $line, $match) ) {
	                $unique_key = bin2hex(openssl_random_pseudo_bytes(32));
	                $line = "define('$match[1]', '" . $unique_key . "');\n";
	
		} elseif ( preg_match( '/^define\(\'(WP_CRON_LOCK_TIMEOUT|AUTOSAVE_INTERVAL|WP_POST_REVISIONS|EMPTY_TRASH_DAYS|WP_AUTO_UPDATE_CORE)\',/', $line) ) {
	                $line = "";
		} elseif ( preg_match('/(\\/\\*\\s+That\'s\\s+all,\\s+stop\\s+editing!\\s+Happy\\s+blogging\\.\\s+\\*\\/)/', $line, $match) ) {
	                // insert defines before comment that indicates where we need to stop editing
	                $line = "
// Settings modified by hosting provider
define( 'WP_CRON_LOCK_TIMEOUT', 120   );
define( 'AUTOSAVE_INTERVAL',    300   );
define( 'WP_POST_REVISIONS',    5     );
define( 'EMPTY_TRASH_DAYS',     7     );
define( 'WP_AUTO_UPDATE_CORE',  true  );
$match[1]\n";
	
		}
	}

	unset( $line );

	$handle = fopen( 'wp-config.php', 'w' );
    if (!$handle) {
        die("Unable to open wp-config.php for output.");
    }

	foreach ( $config_file as $line ) {
		fwrite( $handle, $line );
	}

	fclose( $handle );

}


function check_wp_action ( $action ) {
	if ( $action !== TRUE ) {
		echo "[WARN]\tReturn code $action\n";
	} else {
		echo "[OK]\tReturn code $action\n";
	}
}


function plugin_activation( $plugin ) {
	$ret = FALSE;
	if( ! function_exists('activate_plugin') ) {
		require_once ABSPATH . 'wp-admin/includes/plugin.php';
	}

	if( ! is_plugin_active( $plugin ) ) {
		if ( ! is_wp_error( activate_plugin( $plugin ) ) ) {
			$ret = TRUE;
		}
	}

	return $ret;
}

function activate_plugin_list($plugin_list) {
	foreach(file($plugin_list) as $plugin) {
		$plugin = trim($plugin);
		$message = "";
	    $time_start = microtime(true);

		if ( !file_exists("wp-content/plugins/$plugin") ) {
			$message = "[WARN]\tPlugin $plugin doesn't exist";
		} else {
			if ( plugin_activation($plugin) !== TRUE ) {
				 $message = "[WARN]\tPlugin $plugin NOT activated";
			} else {
				 $message = "[OK]\tPlugin $plugin activated";
			}
		}

        $time_end = microtime(true);
	    $time = round(($time_end - $time_start) * 1000,5);
		echo $message . " took ${time}ms\n";
	}
}

function activate_plugin_list_array($plugin_list) {
	foreach($plugin_list as $plugin) {
		$message = "";
	    $time_start = microtime(true);

		if ( !file_exists("wp-content/plugins/$plugin") ) {
			$message = "[WARN]\tPlugin $plugin doesn't exist";
		} else {
			if ( plugin_activation($plugin) !== TRUE ) {
				 $message = "[WARN]\tPlugin $plugin NOT activated";
			} else {
				 $message = "[OK]\tPlugin $plugin activated";
			}
		}

        $time_end = microtime(true);
	    $time = round(($time_end - $time_start) * 1000,5);
		echo $message . " took ${time}ms\n";
	}
}

function mu_plugin_check($muplugin_list) {
	foreach(file($muplugin_list) as $muplugin) {
		$muplugin = trim($muplugin);
		if ( !file_exists("wp-content/mu-plugins/$muplugin") ) {
			echo "[WARN]\tmu-plugin $muplugin doesn't exist\n";
		} else {
			echo "[OK]\tmu-plugin $muplugin detected\n";
		}
	}
}

function mu_plugin_check_array($muplugin_list) {
	foreach($muplugin_list as $muplugin) {
		if ( !file_exists("wp-content/mu-plugins/$muplugin") ) {
			echo "[WARN]\tmu-plugin $muplugin doesn't exist\n";
		} else {
			echo "[OK]\tmu-plugin $muplugin detected\n";
		}
	}

}


function setup_options($install_options) {

	// Put options in getopts format
	$opts = array();

	foreach ($install_options as $opt => $def) {
		if ( $def === "::" ) {
			array_push($opts, $opt . "::");
		} else {
	                array_push($opts, $opt . ":");
		}
	}

	$cli_opts = getopt("",$opts);
	
	foreach ($install_options as $value => $def) {
		$required = 0;

		if ( $def === "::") { $required = 1; }
	
		//Priority ENV -> POST -> CLI
		if ( getenv($value) ) {
			echo "[OK]\t$value hit ENV\n";
			$install_options[$value] = getenv($value);
		} else if ( isset($_POST[$value]) ) {
			echo "[OK]\t$value hit POST\n";
			$install_options[$value] = $_POST[$value];
		} else if ( isset($cli_opts[$value]) ) {
			echo "[OK]\t$value hit CLI\n";
			$install_options[$value] = $cli_opts[$value];
		} else {
			if ( $required == 1 ) { die("[ERROR]\t$value is listed as a required value.\n"); }
			if ( !isset($install_options[$value]) ) {
				$install_options[$value] = "";
			}
		}

	}

	return $install_options;

}

function update_option_audit( $option, $value ) {
	$time_start = microtime(true);
	$ret = update_option( $option, $value);
        $time_end = microtime(true);

        $time = round(($time_end - $time_start) * 1000,5);

        $val = "[WARN]";
        if (  TRUE === $ret ) {
                $val = "[OK]";
        }
        echo "$val\toption_update $option ... took " . $time . "ms and $message, retval $ret\n";


	//wp_function_check( function() { return update_option( $option, $value); } );

}

/*
function wp_function_check ($function) {
	$time_start = microtime(true);
	echo $function();

	$time_end = microtime(true);
	echo "$time_start :: $time_end\n";
	$time = round(($time_end - $time_start) * 1000,5);

	$val = "[FAILED]
	if ( 0 == $ret ) {
		$val = "[OK]";
	}
	echo "$val\toption_update $option ... took " . $time . "ms and $message -- $ret\n";";

	//echo "Function took " . $time . "ms\n";
}
*/

?>

Anon7 - 2021