GRAYBYTE WORDPRESS FILE MANAGER3017

Server IP : 68.65.123.43 / Your IP : 216.73.216.162
System : Linux server266.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
PHP Version : 8.0.30
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/inteuuod/public_html/wp-content/plugins/userswp/includes/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/inteuuod/public_html/wp-content/plugins/userswp/includes//class-tables.php
<?php
/**
 * UsersWP table related functions
 *
 * @since      1.0.0
 * @author     GeoDirectory Team <info@wpgeodirectory.com>
 */
class UsersWP_Tables {

	/**
	 * Creates UsersWP related tables.
	 *
	 * @since       1.0.0
	 * @package     userswp
	 *
	 * @return      void
	 */
	public function create_tables()
	{

		global $wpdb;

		$wpdb->hide_errors();

		// we may need to do some updates before dbDelta
		self::upgrade_1200();

		$collate = '';
		if ($wpdb->has_cap('collation')) {
			if (!empty($wpdb->charset)) $collate = "DEFAULT CHARACTER SET $wpdb->charset";
			if (!empty($wpdb->collate)) $collate .= " COLLATE $wpdb->collate";
		}

		/**
		 * Include any functions needed for upgrades.
		 *
		 * @since 1.0.0
		 */
		require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
		$table_name = uwp_get_table_prefix() . 'uwp_form_fields';
		$form_fields = "CREATE TABLE " . $table_name . " (
							  id int(11) NOT NULL AUTO_INCREMENT,
							  form_type varchar(100) NULL,
							  data_type varchar(100) NULL,
							  field_type varchar(255) NOT NULL COMMENT 'text,checkbox,radio,select,textarea',
							  field_type_key varchar(255) NOT NULL,
							  site_title varchar(255) NULL DEFAULT NULL,
							  form_label varchar(255) NULL DEFAULT NULL,
							  help_text varchar(255) NULL DEFAULT NULL,
							  htmlvar_name varchar(255) NULL DEFAULT NULL,
							  default_value text NULL DEFAULT NULL,
							  sort_order int(11) NOT NULL,
							  option_values text NULL DEFAULT NULL,
							  is_active enum( '0', '1' ) NOT NULL DEFAULT '1',
							  placeholder_value varchar(255) NULL DEFAULT NULL,
							  for_admin_use enum( '0', '1' ) NOT NULL DEFAULT '0',
							  is_default enum( '0', '1' ) NOT NULL DEFAULT '0',
							  is_dummy enum( '0', '1' ) NOT NULL DEFAULT '0',
							  is_public enum( '0', '1', '2' ) NOT NULL DEFAULT '0',
							  is_required enum( '0', '1' ) NOT NULL DEFAULT '0',
							  is_register_field enum( '0', '1' ) NOT NULL DEFAULT '0',
							  is_search_field enum( '0', '1' ) NOT NULL DEFAULT '0',
							  is_register_only_field enum( '0', '1' ) NOT NULL DEFAULT '0',
							  required_msg varchar(255) NULL DEFAULT NULL,
							  show_in text NULL DEFAULT NULL,
							  user_roles text NULL DEFAULT NULL,
							  extra_fields text NULL DEFAULT NULL,
							  field_icon varchar(255) NULL DEFAULT NULL,
							  css_class varchar(255) NULL DEFAULT NULL,
							  decimal_point varchar( 10 ) NOT NULL,
							  validation_pattern varchar( 255 ) NOT NULL,
							  validation_msg text NULL DEFAULT NULL,
							  form_id int(11) NOT NULL DEFAULT 1,
							  user_sort enum( '0', '1' ) NOT NULL DEFAULT '0',
							  PRIMARY KEY  (id)
							  ) $collate";

		$form_fields = apply_filters('uwp_before_form_field_table_create', $form_fields);

		dbDelta($form_fields);

		$extras_table_name = uwp_get_table_prefix() . 'uwp_form_extras';

		$form_extras = "CREATE TABLE " . $extras_table_name . " (
									  id int(11) NOT NULL AUTO_INCREMENT,
									  form_type varchar(255) NOT NULL,
									  field_type varchar(255) NOT NULL COMMENT 'text,checkbox,radio,select,textarea',
									  site_htmlvar_name varchar(255) NOT NULL,
									  sort_order int(11) NOT NULL,
									  is_default enum( '0', '1' ) NOT NULL DEFAULT '0',
									  is_dummy enum( '0', '1' ) NOT NULL DEFAULT '0',
									  expand_custom_value int(11) NULL DEFAULT NULL,
									  searching_range_mode int(11) NULL DEFAULT NULL,
									  expand_search int(11) NULL DEFAULT NULL,
									  front_search_title varchar(255) CHARACTER SET utf8 NULL DEFAULT NULL,
									  front_css_class varchar(255) NULL DEFAULT NULL,
									  first_search_value int(11) NULL DEFAULT NULL,
									  first_search_text varchar(255) CHARACTER SET utf8 NULL DEFAULT NULL,
									  last_search_text varchar(255) CHARACTER SET utf8 NULL DEFAULT NULL,
									  search_min_value int(11) NULL DEFAULT NULL,
									  search_max_value int(11) NULL DEFAULT NULL,
									  search_diff_value int(11) NULL DEFAULT NULL,
									  search_condition varchar(100) NULL DEFAULT NULL,
									  field_input_type varchar(255) NULL DEFAULT NULL,
									  field_data_type varchar(255) NULL DEFAULT NULL,
									  form_id int(11) NOT NULL DEFAULT 1,
									  PRIMARY KEY  (id)
									) $collate AUTO_INCREMENT=1 ;";

		$form_extras = apply_filters('uwp_before_form_extras_table_create', $form_extras);

		dbDelta($form_extras);

		// Table for storing userswp usermeta
		$usermeta_table_name = get_usermeta_table_prefix() . 'uwp_usermeta';
		$user_meta = "CREATE TABLE " . $usermeta_table_name . " (
						user_id int(20) NOT NULL,
						user_ip varchar(20) NULL DEFAULT NULL,
						user_privacy text NULL DEFAULT NULL,
						tabs_privacy text NULL DEFAULT NULL,
						username varchar(255) NULL DEFAULT NULL,
						email varchar(255) NULL DEFAULT NULL,
						first_name varchar(255) NULL DEFAULT NULL,
						last_name varchar(255) NULL DEFAULT NULL,
						avatar_thumb varchar(255) NULL DEFAULT NULL,
						banner_thumb varchar(255) NULL DEFAULT NULL,
                        display_name varchar(255) NULL DEFAULT NULL,
                        user_url text NULL DEFAULT NULL,
                        bio text NULL DEFAULT NULL,
						PRIMARY KEY  (user_id)
						) $collate ";

		$user_meta = apply_filters('uwp_before_usermeta_table_create', $user_meta);

		dbDelta($user_meta);

		// profile tabs layout table
		$profile_tabs_table_name = uwp_get_table_prefix() . 'uwp_profile_tabs';
		$tabs_tbl_query = " CREATE TABLE " . $profile_tabs_table_name . " (
							  id int(11) NOT NULL AUTO_INCREMENT,
							  form_type varchar(100) NULL,
							  sort_order int(11) NOT NULL,
							  tab_layout varchar(100) NOT NULL,
							  tab_type varchar(100) NOT NULL,
							  tab_level int(11) NOT NULL,
							  tab_parent int(11) NOT NULL,
							  tab_privacy int(11) NOT NULL DEFAULT '0',
							  user_decided int(11) NOT NULL DEFAULT '0',
							  tab_name varchar(255) NOT NULL,
							  tab_icon varchar(255) NOT NULL,
							  tab_key varchar(255) NOT NULL,
							  tab_content text NULL DEFAULT NULL,
							  form_id int(11) NOT NULL DEFAULT 1,
							  PRIMARY KEY  (id)
							  ) $collate; ";

		$tabs_tbl_query = apply_filters('uwp_profile_tabs_table_create_query', $tabs_tbl_query);

		dbDelta($tabs_tbl_query);

		// user sorting options table
		$user_sorting_table_name = uwp_get_table_prefix() . 'uwp_user_sorting';
		$tabs_tbl_query = " CREATE TABLE " . $user_sorting_table_name . " (
							  id int(11) NOT NULL AUTO_INCREMENT,
							  data_type varchar(255) NOT NULL,
							  field_type varchar(255) NOT NULL,
							  site_title varchar(255) NOT NULL,
							  htmlvar_name varchar(255) NOT NULL,
							  field_icon varchar(255) NULL DEFAULT NULL,
						      sort_order int(11) NOT NULL DEFAULT '0',
							  tab_parent varchar(100) NOT NULL DEFAULT '0',
							  tab_level int(11) NOT NULL DEFAULT '0',
							  is_active int(11) NOT NULL DEFAULT '0',
							  is_default int(11) NOT NULL DEFAULT '0',
							  sort varchar(5) DEFAULT 'asc',
							  PRIMARY KEY  (id)
							  ) $collate; ";

		$tabs_tbl_query = apply_filters('uwp_user_sorting_table_create_query', $tabs_tbl_query);

		dbDelta($tabs_tbl_query);

	}

	/**
	 * Deleting the table whenever a blog is deleted
	 *
	 * @since       1.0.0
	 * @package     userswp
	 *
	 * @param       array       $tables     Tables to delete.
	 *
	 * @return      array                   Modified table array to delete
	 */
	public function drop_tables_on_delete_blog( $tables ) {
		global $wpdb;
		$tables[] = $wpdb->prefix . 'uwp_form_fields';
		$tables[] = $wpdb->prefix . 'uwp_form_extras';
		$tables[] = $wpdb->prefix . 'uwp_usermeta';
		$tables[] = $wpdb->prefix . 'uwp_profile_tabs';
		return $tables;
	}

	/**
	 * Returns the table prefix based on the installation type.
	 *
	 * @since       1.0.0
	 * @package     userswp
	 *
	 * @return      string      Table prefix
	 */
	public function get_table_prefix() {
		global $wpdb;
		return $wpdb->prefix;
	}

	/**
	 * Returns the user meta table prefix based on the installation type.
	 *
	 * @since       1.0.16
	 * @package     userswp
	 *
	 * @return      string      Table prefix
	 */
	public function get_usermeta_table_prefix() {
		global $wpdb;

		if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
			require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
		}

		// Network active.
		if ( is_plugin_active_for_network( 'userswp/userswp.php' ) || 1 == get_network_option('', 'uwp_is_network_active') ) {
			return $wpdb->base_prefix;
		} else {
			return $wpdb->prefix;
		}
	}

	/**
	 * Checks whether the column exists in the table.
	 *
	 * @since       1.0.0
	 * @package     userswp
	 *
	 * @param       string      $db             Table name.
	 * @param       string      $column         Column name.
	 *
	 * @return      bool
	 */
	public function column_exists($db, $column)
	{
		global $wpdb;
		$exists = false;
		$columns = $wpdb->get_col("show columns from $db");
		foreach ($columns as $c) {
			if ($c == $column) {
				$exists = true;
				break;
			}
		}
		return $exists;
	}

	/**
	 * Adds column if not exist in the table.
	 *
	 * @since       1.0.0
	 * @package     userswp
	 *
	 * @param       string      $db             Table name.
	 * @param       string      $column         Column name.
	 * @param       string      $column_attr    Column attributes.
	 *
	 * @return      bool|int                    True when success.
	 */
	public function add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
	{
		$excluded = uwp_get_excluded_fields();

		if (!in_array($column, $excluded)) {
			global $wpdb;
			$result = 0;// no rows affected
			if (!$this->column_exists($db, $column)) {
				if (!empty($db) && !empty($column))
					$result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
			}
			return $result;
		} else {
			return true;
		}
	}

	/**
	 * In v1.2.0 we removed some prefixes so they must be updated before dbDelta runs so to not duplicate columns.
	 *
	 * @since 1.2.0
	 */
	public function upgrade_1200(){
		// Only run if its an upgrade, not an install
		if(get_option('uwp_db_version')){
			global $wpdb;
			$meta_table = get_usermeta_table_prefix() . 'uwp_usermeta';
			$fields_table = uwp_get_table_prefix() . 'uwp_form_fields';
			$extras_table = uwp_get_table_prefix() . 'uwp_form_extras';
			$cols = $wpdb->get_results( "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$meta_table' AND  TABLE_SCHEMA ='$wpdb->dbname'");

			if(!empty($cols)){
				$current_cols = array();
				foreach($cols as $col){
					$current_cols[] = $col->COLUMN_NAME;
				}
				foreach($cols as $col){
					if ( strpos( $col->COLUMN_NAME, 'uwp_account_' ) === 0 ) {
						$col_name  = sanitize_sql_orderby($col->COLUMN_NAME);
						$col_type  = $col->COLUMN_TYPE;
						$new_col_name  = in_array($col_name,$current_cols) ? str_ireplace("uwp_account_","",$col_name) : str_ireplace("uwp_account_","_",$col_name);

						$sql = "ALTER TABLE `{$meta_table}` CHANGE `$col_name` `$new_col_name` $col_type";

						// alter the usermeta column
						$wpdb->query( $sql);

						// Update the fields table keys
						$wpdb->update(
							$fields_table,
							array(
								'htmlvar_name' => $new_col_name,
							),
							array( 'htmlvar_name' =>  $col_name),
							array(
								'%s',
							),
							array( '%s' )
						);

						// Update the fields extras table keys
						$wpdb->update(
							$extras_table,
							array(
								'site_htmlvar_name' => $new_col_name,
							),
							array( 'site_htmlvar_name' =>  $col_name),
							array(
								'%s',
							),
							array( '%s' )
						);

					}
				}
			}

			// now change all htmlvar_names
			$wpdb->query( "UPDATE $fields_table SET htmlvar_name = REPLACE(htmlvar_name, 'uwp_account_', '') WHERE htmlvar_name LIKE 'uwp_account_%'");
			$wpdb->query( "UPDATE $fields_table SET htmlvar_name = REPLACE(htmlvar_name, 'uwp_change_', '') WHERE htmlvar_name LIKE 'uwp_change_%'");
			$wpdb->query( "UPDATE $fields_table SET htmlvar_name = REPLACE(htmlvar_name, 'uwp_reset_', '') WHERE htmlvar_name LIKE 'uwp_reset_%'");
			$wpdb->query( "UPDATE $fields_table SET htmlvar_name = REPLACE(htmlvar_name, 'uwp_forgot_', '') WHERE htmlvar_name LIKE 'uwp_forgot_%'");
			$wpdb->query( "UPDATE $fields_table SET htmlvar_name = REPLACE(htmlvar_name, 'uwp_login_', '') WHERE htmlvar_name LIKE 'uwp_login_%'");

			$wpdb->query( "UPDATE $fields_table SET htmlvar_name = 'avatar' WHERE htmlvar_name = 'uwp_avatar_file'");
			$wpdb->query( "UPDATE $fields_table SET htmlvar_name = 'banner' WHERE htmlvar_name = 'uwp_banner_file'");

			$wpdb->query( "UPDATE $extras_table SET site_htmlvar_name = REPLACE(site_htmlvar_name, 'uwp_account_', '') WHERE site_htmlvar_name LIKE 'uwp_account_%'");

		}

	}

    public function get_db_usermeta_columns()
    {   global $wpdb;
        $meta_table = get_usermeta_table_prefix() . 'uwp_usermeta';
        $cols = $wpdb->get_results( "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$meta_table' AND  TABLE_SCHEMA ='$wpdb->dbname'");

        $columns = array();
        if (!empty($cols)) {
            foreach ($cols as $col) {
                $columns[] = $col->COLUMN_NAME;
            }
        }

        return $columns;

    }

}

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 10 2025 04:32:23
inteuuod / inteuuod
0755
helpers
--
July 10 2025 04:32:23
inteuuod / inteuuod
0755
libraries
--
July 10 2025 04:32:23
inteuuod / inteuuod
0755
.htaccess
0.41 KB
July 10 2025 04:32:23
inteuuod / inteuuod
0644
abstract-uwp-privacy.php
3.543 KB
May 24 2018 18:32:58
inteuuod / inteuuod
0644
class-account.php
9.071 KB
January 09 2025 21:52:58
inteuuod / inteuuod
0644
class-activator.php
30.118 KB
February 04 2025 23:32:52
inteuuod / inteuuod
0644
class-addons.php
9.592 KB
March 13 2024 17:47:28
inteuuod / inteuuod
0644
class-ajax.php
2.782 KB
March 13 2024 17:47:28
inteuuod / inteuuod
0644
class-countries.php
11.445 KB
April 28 2022 17:18:48
inteuuod / inteuuod
0644
class-date.php
6.316 KB
September 19 2017 17:57:46
inteuuod / inteuuod
0644
class-emails.php
22.155 KB
April 10 2025 19:10:18
inteuuod / inteuuod
0644
class-files.php
23.46 KB
July 16 2024 18:34:28
inteuuod / inteuuod
0644
class-forms.php
170.66 KB
February 19 2025 22:09:02
inteuuod / inteuuod
0644
class-meta.php
12.987 KB
May 25 2022 16:36:12
inteuuod / inteuuod
0644
class-notices.php
7.954 KB
December 12 2024 21:47:10
inteuuod / inteuuod
0644
class-pages.php
17.646 KB
June 01 2021 17:14:04
inteuuod / inteuuod
0644
class-profile.php
60.792 KB
March 13 2024 17:47:28
inteuuod / inteuuod
0644
class-status.php
19.468 KB
July 16 2020 17:09:12
inteuuod / inteuuod
0644
class-tables.php
13.046 KB
June 25 2024 02:23:32
inteuuod / inteuuod
0644
class-templates.php
43.835 KB
March 19 2025 15:13:04
inteuuod / inteuuod
0644
class-tools.php
38.828 KB
March 13 2024 17:47:28
inteuuod / inteuuod
0644
class-user-notifications.php
5.606 KB
February 19 2025 22:09:02
inteuuod / inteuuod
0644
class-userswp.php
35.552 KB
February 04 2025 23:32:52
inteuuod / inteuuod
0644
class-uwp-background-updater.php
3.044 KB
June 27 2019 18:13:34
inteuuod / inteuuod
0644
class-uwp-compatibility.php
3.123 KB
October 10 2024 19:01:40
inteuuod / inteuuod
0644
class-uwp-defaults.php
9.666 KB
February 04 2025 23:32:52
inteuuod / inteuuod
0644
class-uwp-privacy-erasers.php
1.328 KB
May 24 2018 18:32:58
inteuuod / inteuuod
0644
class-uwp-privacy-exporters.php
3.309 KB
February 19 2020 16:22:32
inteuuod / inteuuod
0644
class-uwp-privacy.php
3.062 KB
December 20 2024 18:16:58
inteuuod / inteuuod
0644
class-uwp-seo.php
11.987 KB
March 13 2024 17:47:28
inteuuod / inteuuod
0644
class-validation.php
15.852 KB
November 01 2023 11:49:38
inteuuod / inteuuod
0644
deprecated-functions.php
0.181 KB
January 23 2020 19:10:04
inteuuod / inteuuod
0644
helpers.php
0.502 KB
January 23 2020 19:10:04
inteuuod / inteuuod
0644
index.php
0.025 KB
July 27 2017 16:44:24
inteuuod / inteuuod
0644
template-functions.php
6.082 KB
December 12 2024 21:47:10
inteuuod / inteuuod
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF