/** * Checks the legitimacy of the event and saves the results */ public function postEvent() { $return_view = filter_input(INPUT_POST, 'return_view'); if (!empty($return_view)) { $command = 'uop=' . $return_view; } $event = $this->calendar->schedule->loadEvent(); $event->loadPrevious(); if ($event->post()) { if ($event->pid) { /** * if the pid is set, then it's saving a copy event * copy events are changed to source events so * the pid and key are reset */ $event->pid = 0; $event->key_id = 0; } $result = $event->save(); if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); if (PHPWS_Calendar::isJS()) { Layout::nakedDisplay(dgettext('calendar', 'An error occurred when saving your event.')); exit; } else { $this->sendMessage(dgettext('calendar', 'An error occurred when saving your event.'), 'aop=schedules'); } } else { $result = $this->saveRepeat($event); if (PHPWS_Error::isError($result)) { if (PHPWS_Calendar::isJS()) { PHPWS_Error::log($result); Layout::nakedDisplay(dgettext('calendar', 'An error occurred when trying to repeat an event.'), 'aop=schedules'); exit; } else { $this->sendMessage(dgettext('calendar', 'An error occurred when trying to repeat an event.', 'aop=schedules')); } } PHPWS_Cache::remove(sprintf('grid_%s_%s_%s', date('n', $event->start_time), date('Y', $event->start_time), $this->calendar->schedule->id)); PHPWS_Cache::remove(sprintf('list_%s_%s_%s', date('n', $event->start_time), date('Y', $event->start_time), $this->calendar->schedule->id)); $view = filter_input(INPUT_POST, 'view'); if (!empty($view)) { $this->sendMessage(dgettext('calendar', 'Event saved.'), 'view=' . $view . '&date=' . $event->start_time . '&event_id=' . $event->id . '&sch_id=' . $this->calendar->schedule->id); } else { $this->sendMessage(dgettext('calendar', 'Event saved.'), 'aop=schedules'); } } } else { $this->editEvent($event); } }
public function save() { PHPWS_Core::initModClass('search', 'Search.php'); if (!$this->id) { $new = true; $this->create_date = time(); } else { $new = false; } $this->last_updated = time(); // If this page has a parent and the order is not set // then increment if (!$this->page_order && $this->parent_page) { $page_order = $this->getLastPage(); if (!PHPWS_Error::logIfError($page_order)) { $this->page_order = $page_order + 1; } else { $this->page_order = 1; } } $db = new PHPWS_DB('ps_page'); if (PHPWS_Error::logIfError($db->saveObject($this))) { return false; } $this->saveKey(); if ($new && Current_User::isRestricted('pagesmith')) { Current_User::giveItemPermission($this->_key); } $search = new Search($this->key_id); $search->resetKeywords(); $search->addKeywords($this->title); PHPWS_Error::logIfError($search->save()); foreach ($this->_sections as $section) { $section->pid = $this->id; PHPWS_Error::logIfError($section->save($this->key_id)); } PHPWS_Cache::remove($this->cacheKey()); }
/** * Resets the cache on the RSS feed */ public function reset() { $cache_key = $this->address; PHPWS_Cache::remove($cache_key); }
function flushCache() { if (PHPWS_Cache::remove('whatsnew_cache_key')) { return true; } }
/** * Clears Blog's anonymous cache */ public function resetCache() { for ($i = 1; $i <= MAX_BLOG_CACHE_PAGES; $i++) { PHPWS_Cache::remove(BLOG_CACHE_KEY . $i); } }