';
}
else {
echo '
";
}
function admin_panel_controller(){
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
}
if(!is_writeable($this->plugin_base_dir)){
$this->show_message('The plugin directory (at '.$this->plugin_base_dir.') is not writeable. Because of this, we can\'t download an updated copy of timthumb to use. Try changing permissions on this directory to 755 (or in certain cases, 777)', 'error');
}
if ( isset( $_REQUEST['cg-tvs-action'] ) ) {
switch ( $_REQUEST['cg-tvs-action'] ) {
case 'scan':
$this->scan();
break;
case 'fix':
$this->get_timthumb_src_version();
if(version_compare($this->current_timthumb_src_version, $this->script_latest_version, '<')){
$this->download_new_timthumb_src();
}
if ( wp_verify_nonce( $_POST['_wpnonce'], 'fix_timthumb_files' ) ) {
if( is_array( $_POST['fix'] ) && !empty( $_POST['fix'] ) ){
foreach( $_POST['fix'] as $file_id ) {
$this->fix_file( $this->script_instances[intval($file_id)]['path'] );
}
}
$this->scan(); // Re-scan site
}
break;
case 'fixall':
$nonce = $_GET['_wpnonce'];
if ( wp_verify_nonce( $nonce, 'fix_all_timthumb_files' ) ) {
$vulnerable_files = $this->get_vulnerable_files();
if ( is_array( $vulnerable_files ) && ! empty( $vulnerable_files ) ) {
foreach ( $vulnerable_files as $file ) {
$this->fix_file( $file );
}
$this->scan(); // Re-scan site
}
}
break;
case 'update-options':
$nonce = $_POST['_wpnonce'];
if ( wp_verify_nonce( $nonce, 'update_tvs_options' ) ) {
if($_POST['scan-daily']){
$this->scan_daily = true;
if ( !wp_next_scheduled( 'cg_tvs_daily_scan' ) ) {
wp_schedule_event(time(), 'daily', 'cg_tvs_daily_scan');
}
}else{
$this->scan_daily = false;
wp_clear_scheduled_hook('cg_tvs_daily_scan');
}
}
break;
}
}
if(!empty($this->suspicious_files)){
$this->show_message('
Oh no! Files on your site indicate that your server has already been compromised by the timthumb vulnerability.', 'error');
}
include_once 'cg-tvs-admin-panel-display.php';
}
}