/** {@inheritDoc} */ public function beforeRemove() { if ($this->object->get('default')) { return $this->modx->lexicon('gl_err_lock'); } return parent::beforeRemove(); }
public function beforeRemove() { if ($this->object->name == 'id') { return $this->modx->lexicon('collections.err.cant_remove_id_column'); } return parent::beforeRemove(); }
/** {@inheritDoc} */ public function beforeRemove() { if (!$this->modx->getOption('mlmsystem_allow_remove_story')) { $this->failure($this->modx->lexicon('mlmsystem_err_lock')); } return parent::beforeRemove(); }
/** {@inheritDoc} */ public function beforeRemove() { if (!$this->object->get('editable')) { $this->failure($this->modx->lexicon('subdomainsfolder_err_lock')); } return parent::beforeRemove(); }
public function beforeRemove() { if ($this->object->get('id') == 1 || $this->object->get('name') == $this->modx->lexicon('default')) { return $this->failure($this->modx->lexicon('dashboard_err_remove_default')); } return parent::beforeRemove(); }
/** {@inheritDoc} */ public function beforeRemove() { /* if (!$this->object->get('editable')) { $this->failure($this->modx->lexicon('staticcontent_err_lock')); }*/ return parent::beforeRemove(); }
public function beforeRemove() { $this->conversationId = $this->object->conversationId; if (!($this->conversation = $this->modx->getObject('modxTalksConversation', $this->conversationId))) { return $this->modx->lexicon('modxtalks.empty_conversation'); } $cProperties = $this->conversation->getProperties('comments'); $this->conversation->setProperties(array('total' => ++$cProperties['total'], 'deleted' => $cProperties['deleted'], 'unconfirmed' => $cProperties['unconfirmed'] > 0 ? --$cProperties['unconfirmed'] : 0), 'comments', false); $q = $this->modx->newQuery('modxTalksPost', array('conversationId' => $this->conversationId)); $q->sortby('idx', 'DESC'); $idx = 0; if ($lastComment = $this->modx->getObject('modxTalksPost', $q)) { $idx = $lastComment->get('idx'); } $this->comment = $this->modx->newObject('modxTalksPost'); $time = time(); $commentParams = array('idx' => ++$idx, 'conversationId' => $this->conversationId, 'time' => $time, 'date' => strftime('%Y%m', $time), 'content' => $this->object->content, 'ip' => $this->object->ip); if ($this->object->userId > 0) { $commentParams['userId'] = $this->object->userId; } else { $commentParams['username'] = $this->object->username; $commentParams['useremail'] = $this->object->useremail; } $this->comment->fromArray($commentParams); if ($this->comment->save() !== true) { return $this->modx->lexicon('modxtalks.error'); } if ($this->conversation->save() !== true) { return $this->modx->lexicon('modxtalks.error'); } $this->modx->invokeEvent('OnModxTalksCommentAfterAdd', array('mode' => modSystemEvent::MODE_NEW, $this->comment->getPK() => $this->comment->getPrimaryKey(), 'modxtalks.post' => &$this->comment, 'object' => &$this->comment)); return parent::beforeRemove(); }
public function beforeRemove() { if ($this->getProperty($this->primaryKeyField) != $this->object->get($this->primaryKeyField)) { return 'Primary key not valid'; } return parent::beforeRemove(); }
public function beforeRemove() { $this->conversationId = $this->object->conversationId; if (!($conversation = $this->modx->getObject('modxTalksConversation', $this->conversationId))) { return $this->modx->lexicon('modxtalks.empty_conversation'); } $cProperties = $conversation->getProperty('unconfirmed', 'comments', 0); $unconfirmed = $cProperties['unconfirmed'] > 0 ? --$cProperties['unconfirmed'] : 0; $conversation->setProperty('unconfirmed', $unconfirmed); if ($conversation->save() !== true) { return $this->modx->lexicon('modxtalks.error'); } if ($this->modx->getCount('modxTalksIpBlock', array('ip' => $this->object->ip))) { return $this->modx->lexicon('modxtalks.ip_blocked'); } $ip = $this->modx->newObject('modxTalksIpBlock', array('ip' => $this->object->ip, 'date' => time(), 'intro' => '')); if ($ip->save() !== true) { return $this->modx->lexicon('modxtalks.ip_save_error'); } if ($this->object->userId > 0) { if ($user = $this->modx->getObject('modUser', $this->object->userId)) { $user->set('active', false); if ($user->save() !== true) { return $this->modx->lexicon('modxtalks.error'); } } } return parent::beforeRemove(); }
/** * Can contain pre-removal logic; return false to prevent remove. * @return boolean */ public function beforeRemove() { $smarttagTagresources = $this->object->getMany('Tagresources'); if ($smarttagTagresources) { foreach ($smarttagTagresources as $smarttagTagresource) { $resource = $this->modx->getObject('modResource', $smarttagTagresource->get('resource_id')); if (!$resource) { continue; } $tvValue = $resource->getTVValue($smarttagTagresource->get('tmplvar_id')); if (!$tvValue) { continue; } // getting values from parsed 'smarttag' output $tvValue = str_replace(',', '||', $tvValue); // getting values from 'default' output $tvValues = @explode('||', $tvValue); $tvValues = array_unique($tvValues); $key = array_search($this->object->get('tag'), $tvValues); if (is_numeric($key)) { unset($tvValues[$key]); $tvValue = @implode('||', $tvValues); $resource->setTVValue($smarttagTagresource->get('tmplvar_id'), $tvValue); } } } return parent::beforeRemove(); }
public function beforeRemove() { if ($this->isAdminGroup()) { return $this->modx->lexicon('user_group_err_remove_admin'); } return parent::beforeRemove(); }
/** {@inheritDoc} */ public function beforeRemove() { if (!$this->object->get('editable')) { return ''; } return parent::beforeRemove(); }
/** * Make sure user is message recipient * @return bool */ public function beforeRemove() { if ($this->object->get('recipient') != $this->modx->user->get('id')) { return $this->modx->lexicon($this->objectType . '_err_remove_notauth'); } return parent::beforeRemove(); }
public function beforeRemove() { $service = $this->object->get('service'); if ($service != 6) { return $this->modx->lexicon('system_events_err_remove_not_allowed'); } return parent::beforeRemove(); }
public function beforeRemove() { $settings = $this->modx->getCollection('cgSetting', array('group' => $this->object->get('id'))); foreach ($settings as $setting) { /* @var cgSetting $setting */ $setting->set('group', 0); $setting->save(); } return parent::beforeRemove(); }
public function beforeRemove() { if ($this->isCoreRole()) { return $this->modx->lexicon('role_err_remove_admin'); } /* don't delete if this role is assigned */ if ($this->isAssigned()) { return $this->modx->lexicon('role_err_has_users'); } return parent::beforeRemove(); }
public function beforeRemove() { $templatesCount = $this->modx->getCount($this->classKey); if ($templatesCount == 1) { return $this->modx->lexicon('collections.err.template_remove_last'); } if ($this->object->global_template == 1) { return $this->modx->lexicon('collections.err.template_remove_global'); } return parent::beforeRemove(); }
public function beforeRemove() { /* check if we are deleting our own record */ if ($this->isSelf()) { return $this->modx->lexicon('user_err_cannot_delete_self'); } /* ensure we cant delete last user in Administrator group */ if ($this->isLastUserInAdministrators()) { return $this->modx->lexicon('user_err_cannot_delete_last_admin'); } return parent::beforeRemove(); }
public function beforeRemove() { $this->conversationId = $this->object->conversationId; if (!($conversation = $this->modx->getObject('modxTalksConversation', $this->conversationId))) { return $this->modx->lexicon('modxtalks.empty_conversation'); } $cProperties = $conversation->getProperty('unconfirmed', 'comments', 0); $unconfirmed = $cProperties['unconfirmed'] > 0 ? --$cProperties['unconfirmed'] : 0; $conversation->setProperty('unconfirmed', $unconfirmed); if ($conversation->save() !== true) { return $this->modx->lexicon('modxtalks.error'); } return parent::beforeRemove(); }
public function beforeRemove() { /** * Check if is set packages dir in MODx system settings */ $packagePath = rtrim($this->modx->getOption('gitpackagemanagement.packages_dir', null, null), '/') . '/'; if ($packagePath == null) { $this->modx->log(modX::LOG_LEVEL_ERROR, $this->modx->lexicon('gitpackagemanagement.package_err_ns_packages_dir')); $this->modx->log(modX::LOG_LEVEL_INFO, 'COMPLETED'); return false; } $this->packageFolder = $packagePath . $this->object->dir_name; $configRet = $this->setConfig($this->packageFolder); if ($configRet !== true) { $this->modx->log(modX::LOG_LEVEL_ERROR, $configRet); $this->modx->log(modX::LOG_LEVEL_INFO, 'COMPLETED'); return false; } $this->modx->log(modX::LOG_LEVEL_INFO, 'Uninstallation process begun'); $this->uninstallPackage(); return parent::beforeRemove(); }
/** {@inheritDoc} */ public function beforeRemove() { //$this->failure($this->modx->lexicon('paymentsystem_err_lock')); return parent::beforeRemove(); }
public function beforeRemove() { $this->conversationId = $this->object->get('id'); return parent::beforeRemove(); }
public function beforeRemove() { $this->product = $this->object->getOne('Product'); return parent::beforeRemove(); }
/** {@inheritDoc} */ public function beforeRemove() { return parent::beforeRemove(); }