Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64
User : palandch ( 1163)
PHP Version : 7.1.33
Disable Function : NONE
Directory :  /home/palandch/www/core/model/modx/processors/security/profile/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/palandch/www/core/model/modx/processors/security/profile/update.class.php
<?php
/**
 * Update a user profile
 *
 * @package modx
 * @subpackage processors.security.profile
 */
class modProfileUpdateProcessor extends modProcessor {
    /** @var modUserProfile $profile */
    public $profile;

    public function checkPermissions() {
        return $this->modx->hasPermission('change_profile');
    }
    public function getLanguageTopics() {
        return array('user');
    }

    public function initialize() {
        $this->profile = $this->modx->user->getOne('Profile');
        if (empty($this->profile)) {
            return $this->modx->lexicon('user_profile_err_not_found');
        }
        return true;
    }

    /**
     * {@inheritDoc}
     * 
     * @return array|string
     */
    public function process() {
        $this->prepare();

        /* save profile */
        if ($this->profile->save() == false) {
            return $this->failure($this->modx->lexicon('user_profile_err_save'));
        } else {
            /* log manager action */
            $this->modx->logManagerAction('save_profile','modUser',$this->modx->user->get('id'));
        }

        return $this->success($this->modx->lexicon('success'),$this->profile->toArray());
    }

    public function prepare() {
        $properties = $this->getProperties();
        
        /* format and set data */
        $dob = $this->getProperty('dob');
        if (!empty($dob)) {
            $properties['dob'] = strtotime($dob);
        }
        $this->profile->fromArray($properties);
    }
    
}
return 'modProfileUpdateProcessor';

Spamworldpro Mini