langs = new class_fma_adv_lang(); add_action( 'fma__settings_tab_notifications_content', array( $this, 'notification_callback' ) ); } /** * Notification Callback * @since 6.7.3 */ public function notification_callback() { if ( ! class_exists( 'AFMP\\Modules\\EmailNotification\\EmailNotification' ) ) { echo '
'; echo '

Email notification Settings PRO

'; echo ''; echo '
'; } if ( ! class_exists( 'AFMP\\Modules\\SlackNotification\\SlackNotification' ) ) { echo '
'; echo '

Slack Notification PRO

'; echo ''; echo '
'; } } /** * Loading Menus */ public function load_menus() { $fmaPer = $this->fmaPer(); /** Authorizing only super admin to manage settings */ $subPer = 'manage_options'; if ( is_multisite() && !is_network_admin() ) { $subPer = 'manage_network'; $fmaPer = $this->networkPer(); } add_menu_page( __( 'File Manager', 'file-manager-advanced' ), __( 'File Manager', 'file-manager-advanced' ), $fmaPer, 'file_manager_advanced_ui', array($this, 'file_manager_advanced_ui'), plugins_url( 'assets/icon/fma.png', __FILE__ ), 4 ); add_submenu_page( 'file_manager_advanced_ui', 'Settings', 'Settings', $subPer, 'file_manager_advanced_controls', array(&$this, 'file_manager_advanced_controls')); if(!class_exists('file_manager_advanced_shortcode')) { add_submenu_page( 'file_manager_advanced_ui', 'Shortcodes', 'Shortcodes', $subPer, 'file_manager_advanced_shortcodes', array(&$this, 'file_manager_advanced_shortcodes')); } if ( ! class_exists( 'AFMP\\Modules\\Adminer' ) ) { add_submenu_page( 'file_manager_advanced_ui', 'DB Access', 'DB Access', 'manage_options', 'afmp-adminer', array( $this, 'adminer_menu' ) ); } if ( ! class_exists( 'AFMP\\Modules\\Dropbox' ) ) { add_submenu_page( 'file_manager_advanced_ui', 'Dropbox Settings', 'Dropbox', 'manage_options', 'afmp-dropbox', array( $this, 'dropbox_menu' ) ); } if ( ! class_exists( 'AFMP\\Modules\\FileLogs' ) ) { add_submenu_page( 'file_manager_advanced_ui', 'File Logs', 'File Logs', 'manage_options', 'afmp-file-logs', array( $this, 'afmp__file_logs' ), 2 ); } if ( ! class_exists( 'AFMP\\Modules\\GoogleDrive' ) ) { add_submenu_page( 'file_manager_advanced_ui', 'Google Drive Settings', 'Google Drive', 'manage_options', 'afmp-googledrive', array( $this, 'googledrive_menu' ) ); } if ( ! class_exists( 'AFMP\Modules\Onedrive' ) ) { add_submenu_page( 'file_manager_advanced_ui', 'OneDrive Settings', 'OneDrive', 'manage_options', 'afmp-onedrive', array( $this, 'onedrive_menu' ) ); } } /** * Dropbox menu * @since 6.7.2 */ public function dropbox_menu() { echo '

Dropbox Settings PRO

Enable

Enter a title which will be displayed on File Manager

Enter your Dropbox App key, you will get your app key from Dropbox App Console

Enter your Dropbox App secret, you will get your app secret from Dropbox App Console

Copy this URL and paste it in your Dropbox App Console under Redirect URIs

'; submit_button(); echo '
'; } /** * OneDrive menu * @since 6.7.3 */ public function onedrive_menu() { echo ''; echo '

One Drive Settings PRO

'; echo '
'; echo '

'; echo ''; submit_button(); echo '
'; } /** * Google Drive menu * @since 6.7.2 */ public function googledrive_menu() { echo '

Google Drive Settings PRO

Enable

Enter a title which will be displayed on File Manager

Enter your Google Drive App key, you will get your app key from Google Drive App Console

Enter your Google Drive App secret, you will get your app secret from Google Drive App Console

Copy this URL and paste it in your Google Drive App Console under JavaScripts Origins

Copy this URL and paste it in your Google Drive App Console under Redirect URIs

'; submit_button(); echo '
'; } /** * Adminer menu * @since 6.7.2 */ public function adminer_menu() { require_once FMAFILEPATH . 'templates/adminer.php'; } public function afmp__file_logs() { echo <<

File Logs PRO

Delete All
ID Sort descending.User Sort ascending.Date & Time Sort descending.Event Sort descending.File Path Sort descending.Type Sort descending.IP Address Sort descending.Actions
6admin
john@flywheel.local
May 02, 2025 12:40 pmuploadedD:\Local Sites\file-manager-advanced\app\public\wp-content\HeidiSQL.lnkapplication/x-ms-shortcut127.0.0.1
5admin
john@flywheel.local
May 02, 2025 12:39 pmpastedD:\Local Sites\file-manager-advanced\app\public\wp-content\index.phptext/x-php127.0.0.1
4admin
john@flywheel.local
May 02, 2025 12:39 pmdeletedD:\Local Sites\file-manager-advanced\app\public\wp-content\themes\deletedme.phptext/x-php127.0.0.1
3admin
john@flywheel.local
May 02, 2025 12:39 pmupdatedD:\Local Sites\file-manager-advanced\app\public\wp-content\themes\deletedme.phptext/x-php127.0.0.1
2admin
john@flywheel.local
May 02, 2025 12:39 pmrenamedD:\Local Sites\file-manager-advanced\app\public\wp-content\themes\index copy 1.phptext/x-php127.0.0.1
1admin
john@flywheel.local
May 02, 2025 12:38 pmduplicatedD:\Local Sites\file-manager-advanced\app\public\wp-content\themes\index copy 1.phptext/x-php127.0.0.1
ID Sort descending.User Sort ascending.Date & Time Sort descending.Event Sort descending.File Path Sort descending.Type Sort descending.IP Address Sort descending.Actions
6 items Current Page1 of 1

HTML; } /** * Fma permissions */ public function fmaPer() { $settings = $this->get(); $user = wp_get_current_user(); $allowed_fma_user_roles = isset($settings['fma_user_roles']) ? $settings['fma_user_roles'] : array('administrator'); if(!in_array('administrator', $allowed_fma_user_roles)) { $fma_user_roles = array_merge(array('administrator'), $allowed_fma_user_roles); } else { $fma_user_roles = $allowed_fma_user_roles; } $checkUserRoleExistance = array_intersect($fma_user_roles, $user->roles); if(count($checkUserRoleExistance) > 0 && !in_array('administrator', $checkUserRoleExistance)) { $fmaPer = 'read'; } else { $fmaPer = 'manage_options'; } return $fmaPer; } /** * Fma - Network Permissions */ public function networkPer() { $settings = $this->get(); $user = wp_get_current_user(); $allowed_fma_user_roles = isset($settings['fma_user_roles']) ? $settings['fma_user_roles'] : array(); $fma_user_roles = $allowed_fma_user_roles; $checkUserRoleExistance = array_intersect($fma_user_roles, $user->roles); if(count($checkUserRoleExistance) > 0 ) { if(!in_array('administrator', $checkUserRoleExistance)) { $fmaPer = 'read'; } else { $fmaPer = 'manage_options'; } } else { $fmaPer = 'manage_network'; } return $fmaPer; } /** * Diaplying AFM */ public function file_manager_advanced_ui() { $fmaPer = $this->fmaPer(); if(current_user_can($fmaPer)) { include('pages/main.php'); } } /** * Settings */ public function file_manager_advanced_controls(){ if( current_user_can( 'manage_options' ) ) { include( 'pages/controls.php' ); } } /** * Shortcode */ public function file_manager_advanced_shortcodes(){ if(current_user_can('manage_options')) { include('pages/buy_shortcode.php'); } } /** * Saving Options */ public function save() { if(isset($_POST['submit']) && wp_verify_nonce( $_POST['_fmaform'], 'fmaform' )) { _e('Saving options, Please wait...','file-manager-advanced'); $save = array(); $defaultRole = array('administrator'); if(is_multisite()) { $defaultRole = array(); } $public_dir = isset($_POST['public_path']) ? sanitize_text_field($_POST['public_path']) : ''; $save['fma_user_roles'] = isset($_POST['fma_user_role']) ? array_map('sanitize_text_field',$_POST['fma_user_role']) : $defaultRole; $save['fma_theme'] = isset($_POST['fma_theme']) ? sanitize_text_field($_POST['fma_theme']) : 'light'; $save['fma_locale'] = isset($_POST['fma_locale']) ? sanitize_text_field($_POST['fma_locale']) : 'en'; /* Directory Traversal fix @220723 */ $save['public_path'] = $this->afm_sanitize_directory($public_dir); $save['public_url'] = isset($_POST['public_url']) ? sanitize_text_field($_POST['public_url']) : ''; //25122022 $save['upload_max_size'] = isset($_POST['upload_max_size']) ? sanitize_text_field($_POST['upload_max_size']) : '0'; $save['display_ui_options'] = isset($_POST['display_ui_options']) ? array_map('sanitize_text_field',$_POST['display_ui_options']) : array(); $save['hide_path'] = isset($_POST['hide_path']) ? sanitize_text_field($_POST['hide_path']) : 0; $save['enable_trash'] = isset($_POST['enable_trash']) ? sanitize_text_field($_POST['enable_trash']) : 0; $save['enable_htaccess'] = isset($_POST['enable_htaccess']) ? sanitize_text_field($_POST['enable_htaccess']) : 0; $save['fma_upload_allow'] = isset($_POST['fma_upload_allow']) ? sanitize_text_field($_POST['fma_upload_allow']) : 'all'; $save['fma_cm_theme'] = isset($_POST['fma_cm_theme']) ? sanitize_text_field($_POST['fma_cm_theme']) : 'default'; $u = update_option('fmaoptions',$save); if($u) { $this->f('?page=file_manager_advanced_controls&status=1'); } else { $this->f('?page=file_manager_advanced_controls&status=2'); } } } /** * Sanitize directory path */ public function afm_sanitize_directory($path = '') { if(!empty($path)) { $path = str_replace('..', '', htmlentities(trim($path))); } return $path; } /** * Getting Options */ public function get() { return get_option('fmaoptions'); } /** * Diplay Notices */ public function notice($type, $message) { if(isset($type) && !empty($type)) { $class = ($type == '1') ? 'updated' : 'error'; return '

'.$message.'

'; } } /** * Redirection */ public function f($u) { $url = esc_url_raw($u); wp_register_script( 'fma-redirect-script', ''); wp_enqueue_script( 'fma-redirect-script' ); wp_add_inline_script( 'fma-redirect-script', ' window.location.href="'.$url.'" ;' ); } public static function shortcodeUpdateNotice() { if(class_exists('file_manager_advanced_shortcode')): if(defined('fmas_ver')){ if(fmas_ver < '2.4.1') { return '

Advanced File manager shortcode addon update: You are using version '.fmas_ver.' we recommend you to update to latest version. If you did not receive update please download from my account page.

'; } } else { return '

Advanced File manager shortcode addon update: You are using old version, we recommend you to update to latest version. If you did not receive update please download from my account page.

'; } endif; } /** * Get User Roles */ public function wpUserRoles() { global $wp_roles; return $wp_roles->roles; } }