Esempio n. 1
0
 /** {@inheritDoc} */
 public function beforeRemove()
 {
     if (!$this->modx->getOption('mlmsystem_allow_remove_story')) {
         $this->failure($this->modx->lexicon('mlmsystem_err_lock'));
     }
     return parent::beforeRemove();
 }
Esempio n. 2
0
 /** {@inheritDoc} */
 public function beforeRemove()
 {
     if (!$this->object->get('editable')) {
         return '';
     }
     return parent::beforeRemove();
 }
Esempio n. 3
0
 public function beforeRemove()
 {
     if ($this->object->name == 'id') {
         return $this->modx->lexicon('collections.err.cant_remove_id_column');
     }
     return parent::beforeRemove();
 }
Esempio n. 4
0
 /** {@inheritDoc} */
 public function beforeRemove()
 {
     /*		if (!$this->object->get('editable')) {
     			$this->failure($this->modx->lexicon('staticcontent_err_lock'));
     		}*/
     return parent::beforeRemove();
 }
Esempio n. 5
0
 /** {@inheritDoc} */
 public function beforeRemove()
 {
     if ($this->object->get('default')) {
         return $this->modx->lexicon('gl_err_lock');
     }
     return parent::beforeRemove();
 }
Esempio n. 6
0
 public function beforeRemove()
 {
     if ($this->getProperty($this->primaryKeyField) != $this->object->get($this->primaryKeyField)) {
         return 'Primary key not valid';
     }
     return parent::beforeRemove();
 }
Esempio n. 7
0
 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();
 }
Esempio n. 8
0
 /** {@inheritDoc} */
 public function beforeRemove()
 {
     if (!$this->object->get('editable')) {
         $this->failure($this->modx->lexicon('subdomainsfolder_err_lock'));
     }
     return parent::beforeRemove();
 }
Esempio n. 9
0
 /** {@inheritDoc} */
 public function initialize()
 {
     if (!$this->modx->hasPermission($this->permission)) {
         return $this->modx->lexicon('access_denied');
     }
     return parent::initialize();
 }
Esempio n. 10
0
 public function beforeRemove()
 {
     if ($this->isAdminGroup()) {
         return $this->modx->lexicon('user_group_err_remove_admin');
     }
     return parent::beforeRemove();
 }
Esempio n. 11
0
 public function afterRemove()
 {
     /** @var xPDOFileCache $provider */
     $provider = $this->modx->cacheManager->getCacheProvider('zapier');
     $provider->flush();
     return parent::afterRemove();
 }
 /**
  * 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();
 }
Esempio n. 13
0
 public function initialize()
 {
     if (!($restore = $this->modx->msrevaluation->restoreProcess($this->getProperty('id')))) {
         $this->failure($this->modx->msrevaluation->error);
     }
     return parent::initialize();
 }
Esempio n. 14
0
 /**
  * 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();
 }
Esempio n. 15
0
 public function afterRemove()
 {
     if (!$this->modx->getCount('vpRoute', array('event' => $this->getProperty('event')))) {
         /* remove event */
         $this->modx->virtualpage->doEvent('remove', $this->eventName, 'vpEvent', 10);
     }
     return parent::afterRemove();
 }
Esempio n. 16
0
 public function beforeRemove()
 {
     $service = $this->object->get('service');
     if ($service != 6) {
         return $this->modx->lexicon('system_events_err_remove_not_allowed');
     }
     return parent::beforeRemove();
 }
Esempio n. 17
0
 public function initialize()
 {
     if (!($id = (int) $this->getProperty('order_id'))) {
         return 'Не был получен ID заявки';
     }
     $this->setProperty('id', $id);
     return parent::initialize();
 }
Esempio n. 18
0
 public function beforeSet()
 {
     $subscribe = $this->modx->getObject('modUser', array('username' => $this->getProperty('username')))->get('id');
     $this->setProperty('subscriberid', $subscribe);
     $this->unsetProperty('username');
     $this->unsetProperty('ctx');
     $this->unsetProperty('society_action');
     return parent::beforeSet();
 }
Esempio n. 19
0
 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();
 }
Esempio n. 20
0
 /**
  * @return bool
  */
 public function afterRemove()
 {
     $this->object->clearTicketCache();
     /* @var TicketThread $thread */
     if ($thread = $this->object->getOne('Thread')) {
         $thread->updateLastComment();
     }
     $this->modx->cacheManager->delete('tickets/latest.comments');
     $this->modx->cacheManager->delete('tickets/latest.tickets');
     return parent::afterRemove();
 }
Esempio n. 21
0
 public function initialize()
 {
     if (!$this->modx->hasPermission('delete_comments')) {
         return 'Access denied';
     }
     if (!($comment_id = (int) $this->getProperty('comment_id'))) {
         return 'Не был получен ID комментария';
     }
     $this->setProperty('id', $comment_id);
     return parent::initialize();
 }
Esempio n. 22
0
 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();
 }
Esempio n. 23
0
 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 afterRemove()
 {
     /** @var int $deleteFolder */
     $deleteFolder = $this->getProperty('deleteFolder');
     if ($deleteFolder == 1) {
         $this->modx->log(modX::LOG_LEVEL_INFO, 'Removing directory ' . $this->packageFolder);
         $this->modx->gitpackagemanagement->deleteDirectory($this->packageFolder);
     }
     $this->modx->log(modX::LOG_LEVEL_INFO, 'COMPLETED');
     return parent::afterRemove();
 }
Esempio n. 25
0
 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();
 }
Esempio n. 26
0
 /**
  * Process the Object create processor
  * {@inheritDoc}
  * @return mixed
  */
 public function process()
 {
     $objectArray = $this->object->toArray();
     $recordings = $this->modx->bbbx->getRecordings($objectArray['meeting_id']);
     if (!empty($recordings)) {
         foreach ($recordings as $recording) {
             if (!$this->modx->bbbx->deleteRecordings($recording['recordID'])) {
                 return $this->failure($this->modx->bbbx->getError());
             }
         }
     }
     return parent::process();
 }
Esempio n. 27
0
 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();
 }
Esempio n. 28
0
 /**
  * {@inheritdoc}
  */
 public function afterRemove()
 {
     try {
         // Удаляем из БД
         $table = $this->modx->escape($this->object->get('name'));
         $sql = "DROP TABLE " . $table;
         if ($stmt = $this->modx->prepare($sql)) {
             $stmt->execute();
         }
     } catch (Exception $e) {
         $this->modx->log(modX::LOG_LEVEL_ERROR, '[dbAdmin] ' . $e->getMessage());
     }
     return parent::afterRemove();
 }
Esempio n. 29
0
 public function afterRemove()
 {
     /**
      * Обновляем кэш комментария и темы
      */
     if ($this->modx->modxtalks->mtCache === true) {
         if (!$this->modx->modxtalks->cacheComment($this->comment)) {
             $this->modx->log(xPDO::LOG_LEVEL_ERROR, '[modxTalks web/comment/restore] Error cache the comment with ID ' . $this->comment->id);
         }
         if (!$this->modx->modxtalks->cacheConversation($this->conversation)) {
             $this->modx->log(xPDO::LOG_LEVEL_ERROR, '[modxTalks web/comment/restore] Error cache conversation with ID ' . $this->conversation->id);
         }
     }
     /**
      * Отправляем уведомление о подтверждении комментария пользователю оставившему комментарий
      */
     if (!$this->modx->modxtalks->notifyUser($this->comment)) {
         return $this->modx->lexicon('modxtalks.error');
     }
     $this->success($this->modx->lexicon('modxtalks.comment_approved'));
     return parent::afterRemove();
 }
Esempio n. 30
0
 public function afterRemvoe()
 {
     $this->modx->cacheManager->refresh(array('default' => array('qsb' => array())));
     return parent::afterRemvoe();
 }