示例#1
0
 public function afterSave()
 {
     $categories = $this->getCategories();
     $categories = $this->object->setCategories($categories);
     $this->object->set('categories', $categories);
     return parent::afterSave();
 }
示例#2
0
 public function afterSave()
 {
     $contexts = $this->getProperty('access_contexts', '');
     $contexts = is_array($contexts) ? $contexts : explode(',', $contexts);
     $contexts = array_unique($contexts);
     if (!empty($contexts)) {
         $flush = false;
         if ($this->getProperty('access_admin')) {
             if ($this->addAdminAccess($contexts)) {
                 $flush = true;
             }
         }
         if ($this->getProperty('access_anon')) {
             if ($this->addAnonymousAccess($contexts)) {
                 $flush = true;
             }
         }
         if ($this->getProperty('access_parallel')) {
             if ($this->addParallelUserGroup($contexts)) {
                 $flush = true;
             }
         }
         $userGroups = $this->getProperty('access_usergroups');
         if (!empty($userGroups)) {
             $userGroups = is_array($userGroups) ? $userGroups : explode(',', $userGroups);
             if ($this->addOtherUserGroups($userGroups, $contexts)) {
                 $flush = true;
             }
         }
         if ($flush) {
             $this->flushPermissions();
         }
     }
     return parent::afterSave();
 }
示例#3
0
 public function afterSave()
 {
     /** @var xPDOFileCache $provider */
     $provider = $this->modx->cacheManager->getCacheProvider('oauth2server');
     $provider->flush();
     return parent::afterSave();
 }
示例#4
0
 public function afterSave()
 {
     $this->saveRequired();
     if ($this->validationType) {
         $this->saveValidation();
     }
     return parent::afterSave();
 }
示例#5
0
 public function afterSave()
 {
     $widgets = $this->getProperty('widgets', null);
     if ($widgets != null) {
         $this->assignWidgets($widgets);
     }
     return parent::afterSave();
 }
示例#6
0
 public function afterSave()
 {
     $this->setContexts();
     if ($this->modx->hasPermission('usergroup_user_edit')) {
         $this->setResourceGroups();
     }
     return parent::afterSave();
 }
示例#7
0
 /** {@inheritDoc} */
 public function afterSave()
 {
     $eventId = $this->object->get('event');
     if ($event = $this->modx->getObject('vpEvent', $eventId)) {
         $eventName = $event->get('name');
         // set event
         $this->modx->virtualpage->doEvent('create', $eventName, 'vpEvent', 10);
     }
     return parent::afterSave();
 }
示例#8
0
 /** {@inheritDoc} */
 public function afterSave()
 {
     $this->thread->updateLastMessage();
     /* @var ecMessage $m */
     if ($m = $this->modx->getObject('ecMessage', $this->getProperty('id'))) {
         if ($m->notifyUser()) {
             $m->set('notify', 0);
             $m->set('notify_date', date('Y-m-d H:i:s'));
             $m->save();
         }
     }
     return parent::afterSave();
 }
示例#9
0
 /** {@inheritDoc} */
 public function afterSave()
 {
     $delivery_id = $this->object->get('id');
     /* @var msDeliveryMember $entry */
     $payments = $this->getProperty('payments');
     if (!empty($payments) && is_array($payments)) {
         foreach ($payments as $payment => $v) {
             if ($v == 1) {
                 $entry = $this->modx->newObject('msDeliveryMember');
                 $entry->fromArray(array('delivery_id' => $delivery_id, 'payment_id' => $payment), '', true);
                 $entry->save();
             }
         }
     }
     return parent::afterSave();
 }
示例#10
0
 public function afterSave()
 {
     $urlHistory = new UrlHistory($this->modx);
     $short = $urlHistory->encodeId($this->object->id);
     while ($this->modx->getObject('modResource', array('alias' => $short))) {
         $newObject = $this->modx->newObject('UrlHistoryItem');
         $newObject->set('url', $this->object->url);
         $newObject->save();
         $short = $urlHistory->encodeId($newObject->id, true);
         $newObject->set('short', $short);
         $newObject->save();
         $this->object->remove();
         $this->object = $newObject;
     }
     $siteUrl = $this->modx->getOption('site_url');
     $this->object->set('short', $siteUrl . $short);
     $this->object->save();
     return parent::afterSave();
 }
示例#11
0
 public function afterSave()
 {
     $this->setContexts();
     if ($this->modx->hasPermission('usergroup_user_edit')) {
         $this->setResourceGroups();
     }
     /* access wizard stuff */
     $flush = false;
     $users = $this->getProperty('aw_users', '');
     if (!empty($users)) {
         $this->addUsersViaWizard($users);
     }
     $contexts = $this->getProperty('aw_contexts', '');
     if (!empty($contexts)) {
         $contexts = is_array($contexts) ? $contexts : explode(',', $contexts);
         $contexts = array_unique($contexts);
         $adminPolicy = trim($this->getProperty('aw_manager_policy', 0));
         if (!empty($adminPolicy)) {
             $this->addManagerContextAccessViaWizard($adminPolicy);
         }
         $policy = trim($this->getProperty('aw_contexts_policy', 0));
         if ($this->addContextAccessViaWizard($contexts, $policy)) {
             $flush = true;
         }
         $resourceGroups = $this->getProperty('aw_resource_groups', '');
         if (!empty($resourceGroups)) {
             $this->addResourceGroupsViaWizard($resourceGroups, $contexts);
         }
         $categories = $this->getProperty('aw_categories', '');
         if (!empty($categories)) {
             $this->addElementCategoriesViaWizard($categories, $contexts);
         }
         $parallel = $this->getProperty('aw_parallel', false);
         if ($parallel) {
             $this->addParallelResourceGroup($contexts);
         }
     }
     if ($flush) {
         $this->flushPermissions();
     }
     return parent::afterSave();
 }
示例#12
0
 /**
  * @return bool
  */
 public function afterSave()
 {
     $assetsPath = $this->modx->getOption('msgiftsrusynch_assets_path', null, $this->modx->getOption('assets_path') . 'components/msgiftsrusynch/');
     $path = $assetsPath . 'xml_files/' . $this->object->get('id') . '/';
     mkdir($path);
     for ($i = 0; $i < count($this->xmlFiles); $i++) {
         $ch = curl_init($this->url_gifts_api . $this->xmlFiles[$i]);
         $fp = fopen($path . $this->xmlFiles[$i], 'w+b');
         curl_setopt($ch, CURLOPT_FILE, $fp);
         curl_setopt($ch, CURLOPT_HEADER, 0);
         curl_exec($ch);
         curl_close($ch);
         fclose($fp);
         /*$this->object->set('description',
         			$path . $this->xmlFiles[$i] .' '.
         			$this->url_gifts_api . $this->xmlFiles[$i] .', '.
         			$this->object->get('description')
         		);
         		$this->object->save();*/
     }
     return parent::afterSave();
 }
示例#13
0
 /**
  * Ensure that Admin UserGroup always has access to this context, if not adding Admin ACL
  * @return bool
  */
 public function afterSave()
 {
     $adminGroup = $this->modx->getObject('modUserGroup', array('name' => 'Administrator'));
     if ($adminGroup && $this->object->get('principal') !== $adminGroup->get('id')) {
         $adminContextPolicy = $this->modx->getObject('modAccessPolicy', array('name' => 'Context'));
         if ($adminContextPolicy) {
             $adminContextAccess = $this->modx->getObject($this->classKey, array('principal' => $adminGroup->get('id'), 'principal_class' => 'modUserGroup', 'target' => $this->object->get('target')));
             if (!$adminContextAccess) {
                 $adminContextAccess = $this->modx->newObject('modAccessContext');
                 $adminContextAccess->set('principal', $adminGroup->get('id'));
                 $adminContextAccess->set('principal_class', 'modUserGroup');
                 $adminContextAccess->set('target', $this->object->get('target'));
                 $adminContextAccess->set('policy', $adminContextPolicy->get('id'));
                 $adminContextAccess->save();
             }
         }
     }
     if ($this->modx->getUser()) {
         $this->modx->user->getAttributes(array(), '', true);
     }
     return parent::afterSave();
 }
示例#14
0
 /**
  * {@inheritDoc}
  * @return boolean
  */
 public function afterSave()
 {
     $this->setUserGroups();
     $this->sendNotificationEmail();
     return parent::afterSave();
 }
示例#15
0
 public function afterSave()
 {
     $_SESSION['comment_time'] = time();
     /**
      * Refresh comment and conversation cache
      */
     if ($this->modx->modxtalks->mtCache === true) {
         if (!$this->modx->modxtalks->cacheComment($this->object)) {
             $this->modx->log(xPDO::LOG_LEVEL_ERROR, '[modxTalks web/comment/create] Error cache the comment with ID ' . $this->object->id);
         }
         if (!$this->modx->modxtalks->cacheConversation($this->theme)) {
             $this->modx->log(xPDO::LOG_LEVEL_ERROR, '[modxTalks web/comment/create] Error cache the conversation with ID ' . $this->theme->id);
         }
     }
     /**
      * Send Notify to conversation moderators
      */
     $success = false;
     if (!$this->modx->modxtalks->isDisabledFunction('exec') && $this->modx->modxtalks->sendMail($this->object->id)) {
         $success = true;
     } elseif ($this->modx->modxtalks->notifyModerators($this->object)) {
         $success = true;
     }
     if (!$success) {
         $this->failure($this->modx->lexicon('modxtalks.error_try_again'));
         return false;
     }
     return parent::afterSave();
 }
 public function afterSave()
 {
     $this->modx->cacheManager->refresh(array('default' => array('qsb' => array())));
     return parent::afterSave();
 }
示例#17
0
 public function afterSave()
 {
     $cacheManager = $this->modx->getCacheManager();
     $cacheManager->refresh(array('menu' => array()));
     return parent::afterSave();
 }
示例#18
0
 /** {@inheritDoc} */
 public function afterSave()
 {
     $this->modx->SubdomainsFolder->clearCache();
     return parent::afterSave();
 }
示例#19
0
 public function afterSave()
 {
     return parent::afterSave();
 }
示例#20
0
 public function afterSave()
 {
     $thisid = $this->object->get('id');
     $catArr = explode(',', $this->object->get('cat'));
     foreach ($catArr as $cat) {
         $cats['evid'] = $thisid;
         $cats['catsid'] = $cat;
         $catsConnect = $this->modx->newObject('GcCalendarCatsConnect');
         $catsConnect->fromArray($cats);
         $catsConnect->save();
     }
     $cidArr = explode(',', $this->object->get('cid'));
     foreach ($cidArr as $cal) {
         $cals['evid'] = $thisid;
         $cals['calid'] = $cal;
         $calsConnect = $this->modx->newObject('GcCalendarCalsConnect');
         $calsConnect->fromArray($cals);
         $calsConnect->save();
     }
     $start = $this->object->get('start');
     $end = $this->object->get('end');
     $prArr = array('start' => $start, 'end' => $end, 'evid' => $thisid, 'pr' => 1);
     $prConnect = $this->modx->newObject('GcCalendarDates');
     $prConnect->fromArray($prArr);
     $prConnect->save();
     $repeatDates = $this->object->get('repeatDates');
     $repeatDatesArr = explode(',', $repeatDates);
     $timediff = $end - $start;
     if (!empty($repeatDatesArr)) {
         foreach ($repeatDatesArr as $rd) {
             if ($rd != 0) {
                 $rend = $rd + $timediff;
                 $rArr = array('start' => $rd, 'end' => $rend, 'rep' => 1, 'evid' => $thisid);
                 $rdConnect = $this->modx->newObject('GcCalendarDates');
                 $rdConnect->fromArray($rArr);
                 $rdConnect->save();
             }
         }
     }
     return parent::afterSave();
 }
示例#21
0
 /**
  * {@inheritDoc}
  * @return mixed
  */
 public function afterSave()
 {
     $this->object->addLock();
     $this->setParentToContainer();
     $this->saveResourceGroups();
     $this->checkIfSiteStart();
     return parent::afterSave();
 }
示例#22
0
 public function afterSave()
 {
     $global = $this->getProperty('global_template');
     if ($global == true) {
         $this->modx->updateCollection('CollectionTemplate', array('global_template' => false), array('id:!=' => $this->object->id));
     }
     $templates = $this->getProperty('templates');
     $templates = $this->modx->collections->explodeAndClean($templates);
     $this->object->setTemplates($templates);
     $this->addIdColumn();
     return parent::afterSave();
 }
示例#23
0
 /**
  * @return bool
  */
 public function afterSave()
 {
     if ($this->object->get('published')) {
         $this->thread->fromArray(array('comment_last' => $this->object->get('id'), 'comment_time' => $this->object->get('createdon')));
         $this->thread->save();
     }
     if ($this->guest) {
         if (!isset($_SESSION['TicketComments'])) {
             $_SESSION['TicketComments'] = array('ids' => array());
         }
         $_SESSION['TicketComments']['name'] = $this->object->get('name');
         $_SESSION['TicketComments']['email'] = $this->object->get('email');
         $_SESSION['TicketComments']['ids'][$this->object->get('id')] = 1;
     }
     $this->thread->updateCommentsCount();
     $this->object->clearTicketCache();
     return parent::afterSave();
 }
示例#24
0
 /** {@inheritDoc} */
 public function afterSave()
 {
     $this->thread->updateLastMessage();
     return parent::afterSave();
 }