示例#1
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     // set cookies
     if ($this->useCookies == 1) {
         UserAuthenticationFactory::getInstance()->getUserAuthentication()->storeAccessData($this->user, $this->username, $this->password);
     }
     $oldSessionID = WCF::getSession()->sessionID;
     // change user
     WCF::getSession()->changeUser($this->user);
     // get redirect url
     $this->checkURL();
     $this->saved();
     if (isset($_REQUEST['s']) && $_REQUEST['s'] == $oldSessionID && $oldSessionID != WCF::getSession()->sessionID) {
         // force instant redirect to avoid issues with non-cookie login and the already defined SID_ARG_* constants
         if (preg_match('~[?&]s=[a-f0-9]{40}~i', $this->url)) {
             $this->url = preg_replace('~([?&])s=[a-f0-9]{40}~i', '$1s=' . WCF::getSession()->sessionID, $this->url);
         } else {
             $this->url .= mb_strpos($this->url, '?') === false ? '?' : '&';
             $this->url .= 's=' . WCF::getSession()->sessionID;
         }
         HeaderUtil::redirect($this->url);
         exit;
     }
     // redirect to url
     WCF::getTPL()->assign('__hideUserMenu', true);
     HeaderUtil::delayedRedirect($this->url, WCF::getLanguage()->get('wcf.user.login.redirect'));
     exit;
 }
示例#2
0
	/**
	 * Does the user authentication.
	 */
	protected function initAuth() {
		// this is a work-around since neither RequestHandler
		// nor RouteHandler are populated right now
		$pathInfo = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : '';
		if (empty($pathInfo) || !preg_match('~^/(ACPCaptcha|Login|Logout)/~', $pathInfo)) {
			if (WCF::getUser()->userID == 0) {
				// build redirect path
				$application = ApplicationHandler::getInstance()->getActiveApplication();
				$path = $application->getPageURL() . 'acp/index.php/Login/' . SID_ARG_1ST;
				
				HeaderUtil::redirect($path);
				exit;
			}
			else {
				// work-around for AJAX-requests within ACP
				if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
					try {
						WCF::getSession()->checkPermissions(array('admin.general.canUseAcp'));
					}
					catch (PermissionDeniedException $e) {
						throw new AJAXException(self::getLanguage()->get('wcf.ajax.error.permissionDenied'), AJAXException::INSUFFICIENT_PERMISSIONS, $e->getTraceAsString());
					}
				}
				else {
					WCF::getSession()->checkPermissions(array('admin.general.canUseAcp'));
				}
			}
		}
	}
 public function execute()
 {
     parent::execute();
     $entryEditor = new EntryEditor($this->entry);
     $entryEditor->updateCounters(array('visits' => $this->entry->visits + 1));
     $this->executed();
     HeaderUtil::redirect($this->entry->website);
 }
示例#4
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     WCF::getSession()->register('disclaimerAccepted', true);
     $this->saved();
     WCF::getSession()->update();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Register'));
     exit;
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     MessageForm::save();
     // save the news update
     $this->objectAction = new NewsUpdateAction(array($this->update), 'update', array('data' => array('subject' => $this->subject, 'text' => $this->text)));
     $this->objectAction->executeAction();
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('News', array('application' => 'news', 'object' => $this->news)));
     exit;
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     MessageForm::save();
     // save file
     $data = array_merge($this->additionalFields, array('description' => $this->text, 'subject' => $this->subject));
     $this->objectAction = new EntryFileAction(array($this->entryFile), 'update', array('data' => $data));
     $this->objectAction->executeAction();
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Entry', array('application' => 'filebase', 'object' => $this->entry)));
     exit;
 }
示例#7
0
 /**
  * @see	\wcf\action\IAction::execute()
  */
 public function execute()
 {
     parent::execute();
     // do logout
     WCF::getSession()->delete();
     $this->executed();
     // forward to index page
     // warning: if doLogout() writes a cookie this is buggy in MS IIS
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Login'));
     exit;
 }
 /**
  * @see	\wcf\page\IPage::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (WCF::getSession()->getPermission('admin.user.canViewIpAddress')) {
         $this->validSortFields[] = 'ipAddress';
         $this->validSortFields[] = 'userAgent';
     }
     if (!empty($_POST)) {
         HeaderUtil::redirect(LinkHandler::getInstance()->getLink('UsersOnlineList', array(), 'sortField=' . $this->sortField . '&sortOrder=' . $this->sortOrder));
         exit;
     }
 }
 /**
  * @see wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     // update session
     WCF::getSession()->register('masterPassword', 1);
     WCF::getSession()->update();
     WCF::getSession()->disableUpdate();
     // forward
     if (empty($this->url)) {
         $this->url = LinkHandler::getInstance()->getLink('Index');
     }
     HeaderUtil::redirect($this->url, false);
     exit;
 }
示例#10
0
 /**
  * @see wcf\page\IPage::show()
  */
 public function show()
 {
     // use detailed view if accessing WCF ACP directly
     if (PACKAGE_ID == 1) {
         // base tag is determined on runtime
         $host = RouteHandler::getHost();
         $path = RouteHandler::getPath();
         HeaderUtil::redirect($host . $path . 'index.php/PackageListDetailed/' . SID_ARG_1ST, false);
         exit;
     }
     // enable menu item
     ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.package.list');
     parent::show();
 }
示例#11
0
 /**
  * @see wcf\action\IAction::execute()
  */
 public function execute()
 {
     parent::execute();
     // validate
     if (!WCF::getUser()->userID) {
         throw new IllegalLinkException();
     }
     // do logout
     WCF::getSession()->delete();
     $this->executed();
     // forward to index page
     // warning: if doLogout() writes a cookie this is buggy in MS IIS
     HeaderUtil::redirect('index.php' . SID_ARG_1ST);
     exit;
 }
示例#12
0
 /**
  * @see	\wcf\action\IAction::execute()
  */
 public function execute()
 {
     parent::execute();
     // reset stylesheets
     StyleHandler::resetStylesheets();
     // delete language cache and compiled templates as well
     LanguageFactory::getInstance()->deleteLanguageCache();
     // get package dirs
     CacheHandler::getInstance()->flushAll();
     $this->executed();
     if (!isset($_POST['noRedirect'])) {
         HeaderUtil::redirect(LinkHandler::getInstance()->getLink('CacheList'));
     }
     exit;
 }
示例#13
0
 /**
  * Does the user authentication.
  */
 protected function initAuth()
 {
     // this is a work-around since neither RequestHandler
     // nor RouteHandler are populated right now
     $pathInfo = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
     if (empty($pathInfo) || !preg_match('~^/(ACPCaptcha|Login|Logout)/~', $pathInfo)) {
         if (WCF::getUser()->userID == 0) {
             // build redirect path
             $application = ApplicationHandler::getInstance()->getActiveApplication();
             $path = $application->domainName . $application->domainPath . 'acp/index.php/Login/' . SID_ARG_1ST;
             util\HeaderUtil::redirect($path, false);
             exit;
         } else {
             WCF::getSession()->checkPermissions(array('admin.general.canUseAcp'));
         }
     }
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     MessageForm::save();
     // save the news update
     $this->objectAction = new EntryUpdateAction(array($this->update), 'update', array('data' => array('subject' => $this->subject, 'message' => $this->text)));
     $this->objectAction->executeAction();
     // set news as new
     if ($this->setEntryAsNew) {
         $sql = "UPDATE    cms" . WCF_N . "_news_entry\n                    SET    time = ?\n                    WHERE    entryID = ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array(TIME_NOW, $this->entryID));
         $sql = "DELETE FROM    wcf" . WCF_N . "_tracked_visit\n                    WHERE        objectTypeID = ?\n                    AND        objectID = ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array(VisitTracker::getInstance()->getObjectTypeID('de.incendium.cms.news.entry'), $this->entryID));
         // reset the user storage data
         UserStorageHandler::getInstance()->resetAll('cmsUnreadNewsEntries');
     }
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('NewsEntry', array('application' => 'cms', 'object' => $this->entry)));
     exit;
 }
 /**
  * @see	\wcf\action\IAction::execute()
  */
 public function execute()
 {
     parent::execute();
     if (!$this->notification->confirmTime) {
         UserNotificationHandler::getInstance()->markAsConfirmedByID($this->notification->notificationID);
     }
     $event = new UserNotificationEvent($this->notification->eventID);
     $objectType = ObjectTypeCache::getInstance()->getObjectType($event->objectTypeID);
     $objects = $objectType->getProcessor()->getObjectsByIDs(array($this->notification->objectID));
     $userProfile = null;
     if ($this->notification->authorID) {
         $userProfile = new UserProfile(new User($this->notification->authorID));
     } else {
         $userProfile = new UserProfile(new User(null, array('userID' => null, 'username' => WCF::getLanguage()->get('wcf.user.guest'))));
     }
     $className = $event->className;
     $notificationEvent = new $className($event);
     $notificationEvent->setObject($this->notification, $objects[$this->notification->objectID], $userProfile, $this->notification->additionalData);
     HeaderUtil::redirect($notificationEvent->getLink());
     exit;
 }
示例#16
0
 /**
  * @see wcf\action\IAction::execute()
  */
 public function execute()
 {
     parent::execute();
     // delete language cache and compiled templates as well
     LanguageFactory::getInstance()->deleteLanguageCache();
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
     $conditions->add("isApplication = ?", array(1));
     // get package dirs
     $sql = "SELECT\tpackageDir\n\t\t\tFROM\twcf" . WCF_N . "_package\n\t\t\t" . $conditions;
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute($conditions->getParameters());
     while ($row = $statement->fetchArray()) {
         $packageDir = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
         try {
             CacheHandler::getInstance()->clear($packageDir . 'cache', '*.php');
         } catch (SystemException $e) {
         }
     }
     $this->executed();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('CacheList'));
     exit;
 }
示例#17
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     AbstractForm::save();
     if ($this->objectType->objectType == 'de.codequake.cms.content.type.poll') {
         $this->contentData['pollID'] = PollManager::getInstance()->save($this->contentID);
     }
     // save multilingual inputs
     $languageVariable = 'cms.content.title' . $this->contentID;
     if (I18nHandler::getInstance()->isPlainValue('title')) {
         I18nHandler::getInstance()->remove($languageVariable);
     } else {
         I18nHandler::getInstance()->save('title', $languageVariable, 'cms.content', PACKAGE_ID);
         $this->title = $languageVariable;
     }
     foreach ($this->objectType->getProcessor()->multilingualFields as $field) {
         $languageVariable = 'cms.content.' . $field . $this->contentID;
         if (I18nHandler::getInstance()->isPlainValue($field)) {
             I18nHandler::getInstance()->remove($languageVariable);
         } else {
             I18nHandler::getInstance()->save($field, $languageVariable, 'cms.content', PACKAGE_ID);
             $this->contentData[$field] = $languageVariable;
         }
     }
     $data = array('title' => $this->title, 'pageID' => $this->pageID, 'parentID' => $this->parentID ?: null, 'cssClasses' => $this->cssClasses, 'showOrder' => $this->showOrder, 'position' => $this->position, 'contentData' => $this->contentData, 'contentTypeID' => $this->objectType->objectTypeID);
     $this->objectAction = new ContentAction(array($this->contentID), 'update', array('data' => $data));
     $this->objectAction->executeAction();
     // create revision
     if ($this->pageID == $this->content->pageID) {
         $objectAction = new PageAction(array($this->pageID), 'createRevision', array('action' => 'content.update'));
         $objectAction->executeAction();
     } else {
         $objectAction = new PageAction(array($this->pageID), 'createRevision', array('action' => 'content.create'));
         $objectAction->executeAction();
         $objectAction = new PageAction(array($this->content->pageID), 'createRevision', array('action' => 'content.delete'));
         $objectAction->executeAction();
     }
     // update search index
     $objectAction = new PageAction(array($this->pageID), 'refreshSearchIndex');
     $objectAction->executeAction();
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('ContentList', array('application' => 'cms', 'pageID' => $this->pageID)));
 }
	/**
	 * Opens the package installation queue and
	 * starts the installation, update or uninstallation of the first entry.
	 * 
	 * @param	integer		$parentQueueID
	 * @param	integer		$processNo
	 */
	public static function openQueue($parentQueueID = 0, $processNo = 0) {
		$conditions = new PreparedStatementConditionBuilder();
		$conditions->add("userID = ?", array(WCF::getUser()->userID));
		$conditions->add("parentQueueID = ?", array($parentQueueID));
		if ($processNo != 0) $conditions->add("processNo = ?", array($processNo));
		$conditions->add("done = ?", array(0));
		
		$sql = "SELECT		*
			FROM		wcf".WCF_N."_package_installation_queue
			".$conditions."
			ORDER BY	queueID ASC";
		$statement = WCF::getDB()->prepareStatement($sql);
		$statement->execute($conditions->getParameters());
		$packageInstallation = $statement->fetchArray();
		
		if (!isset($packageInstallation['queueID'])) {
			$url = LinkHandler::getInstance()->getLink('PackageList');
			HeaderUtil::redirect($url);
			exit;
		}
		else {
			$url = LinkHandler::getInstance()->getLink('PackageInstallationConfirm', array(), 'action='.$packageInstallation['action'].'&queueID='.$packageInstallation['queueID']);
			HeaderUtil::redirect($url);
			exit;
		}
	}
示例#19
0
 /**
  * @see	\wcf\page\IPage::show()
  */
 public function show()
 {
     // check if active user is logged in
     if ($this->loginRequired && !WCF::getUser()->userID) {
         throw new PermissionDeniedException();
     }
     // check if current request URL matches the canonical URL
     if ($this->canonicalURL && empty($_POST)) {
         $canoncialURL = parse_url(preg_replace('~[?&]s=[a-f0-9]{40}~', '', $this->canonicalURL));
         // use $_SERVER['REQUEST_URI'] because it represents the URL used to access the site and not the internally rewritten one
         // IIS Rewrite-Module has a bug causing the REQUEST_URI to be ISO-encoded
         $requestURI = !empty($_SERVER['UNENCODED_URL']) ? $_SERVER['UNENCODED_URL'] : $_SERVER['REQUEST_URI'];
         $requestURI = preg_replace('~[?&]s=[a-f0-9]{40}~', '', $requestURI);
         if (!StringUtil::isUTF8($requestURI)) {
             $requestURI = StringUtil::convertEncoding('ISO-8859-1', 'UTF-8', $requestURI);
         }
         // some webservers output lower-case encoding (e.g. %c3 instead of %C3)
         $requestURI = preg_replace_callback('~%(?P<encoded>[a-zA-Z0-9]{2})~', function ($matches) {
             return '%' . strtoupper($matches['encoded']);
         }, $requestURI);
         $requestURL = parse_url($requestURI);
         $redirect = false;
         if ($canoncialURL['path'] != $requestURL['path']) {
             $redirect = true;
         } else {
             if (isset($canoncialURL['query'])) {
                 if (!isset($requestURL['query'])) {
                     $redirect = true;
                 } else {
                     parse_str($canoncialURL['query'], $cQueryString);
                     parse_str($requestURL['query'], $rQueryString);
                     foreach ($cQueryString as $key => $value) {
                         if (!isset($rQueryString[$key]) || $rQueryString[$key] != $value) {
                             $redirect = true;
                             break;
                         }
                     }
                 }
             }
         }
         if ($redirect) {
             $redirectURL = $this->canonicalURL;
             if (!empty($requestURL['query'])) {
                 $queryString = $requestURL['query'];
                 parse_str($requestURL['query'], $rQueryString);
                 if (!empty($canoncialURL['query'])) {
                     parse_str($canoncialURL['query'], $cQueryString);
                     // clean query string
                     foreach ($cQueryString as $key => $value) {
                         if (isset($rQueryString[$key])) {
                             unset($rQueryString[$key]);
                         }
                     }
                 }
                 // drop route data from query
                 if (!URL_LEGACY_MODE) {
                     foreach ($rQueryString as $key => $value) {
                         if ($value === '') {
                             unset($rQueryString[$key]);
                         }
                     }
                 }
                 if (!empty($rQueryString)) {
                     $redirectURL .= (mb_strpos($redirectURL, '?') === false ? '?' : '&') . http_build_query($rQueryString, '', '&');
                 }
             }
             // force a permanent redirect as recommended by Google
             // https://support.google.com/webmasters/answer/6033086?hl=en#a_note_about_redirects
             @header('HTTP/1.0 301 Moved Permanently');
             HeaderUtil::redirect($redirectURL, false);
             exit;
         }
     }
     // sets the active menu item
     $this->setActiveMenuItem();
     // check modules
     $this->checkModules();
     // check permission
     $this->checkPermissions();
     // read data
     $this->readData();
     // assign variables
     $this->assignVariables();
     // call show event
     EventHandler::getInstance()->fireAction($this, 'show');
     // try to guess template name
     $classParts = explode('\\', get_class($this));
     if (empty($this->templateName)) {
         $className = preg_replace('~(Form|Page)$~', '', array_pop($classParts));
         // check if this an *Edit page and use the add-template instead
         if (substr($className, -4) == 'Edit') {
             $className = substr($className, 0, -4) . 'Add';
         }
         $this->templateName = lcfirst($className);
         // assign guessed template name
         WCF::getTPL()->assign('templateName', $this->templateName);
     }
     if (empty($this->templateNameApplication)) {
         $this->templateNameApplication = array_shift($classParts);
         // assign guessed template application
         WCF::getTPL()->assign('templateNameApplication', $this->templateNameApplication);
     }
     if ($this->useTemplate) {
         // show template
         WCF::getTPL()->display($this->templateName, $this->templateNameApplication);
     }
 }
示例#20
0
 /**
  * @see	\wcf\action\IAction::execute()
  */
 public function execute()
 {
     parent::execute();
     // user accepted the connection
     if (isset($_GET['code'])) {
         try {
             // fetch access_token
             $request = new HTTPRequest('https://github.com/login/oauth/access_token', array(), array('client_id' => StringUtil::trim(GITHUB_PUBLIC_KEY), 'client_secret' => StringUtil::trim(GITHUB_PRIVATE_KEY), 'code' => $_GET['code']));
             $request->execute();
             $reply = $request->getReply();
             $content = $reply['body'];
         } catch (SystemException $e) {
             // force logging
             $e->getExceptionID();
             throw new IllegalLinkException();
         }
         // validate state, validation of state is executed after fetching the access_token to invalidate 'code'
         if (!isset($_GET['state']) || $_GET['state'] != WCF::getSession()->getVar('__githubInit')) {
             throw new IllegalLinkException();
         }
         WCF::getSession()->unregister('__githubInit');
         parse_str($content, $data);
         // check whether the token is okay
         if (isset($data['error'])) {
             throw new IllegalLinkException();
         }
         // check whether a user is connected to this github account
         $user = $this->getUser($data['access_token']);
         if ($user->userID) {
             // a user is already connected, but we are logged in, break
             if (WCF::getUser()->userID) {
                 throw new NamedUserException(WCF::getLanguage()->get('wcf.user.3rdparty.github.connect.error.inuse'));
             } else {
                 if (UserAuthenticationFactory::getInstance()->getUserAuthentication()->supportsPersistentLogins()) {
                     $password = StringUtil::getRandomID();
                     $userEditor = new UserEditor($user);
                     $userEditor->update(array('password' => $password));
                     // reload user to retrieve salt
                     $user = new User($user->userID);
                     UserAuthenticationFactory::getInstance()->getUserAuthentication()->storeAccessData($user, $user->username, $password);
                 }
                 WCF::getSession()->changeUser($user);
                 WCF::getSession()->update();
                 HeaderUtil::redirect(LinkHandler::getInstance()->getLink());
             }
         } else {
             try {
                 // fetch userdata
                 $request = new HTTPRequest('https://api.github.com/user?access_token=' . $data['access_token']);
                 $request->execute();
                 $reply = $request->getReply();
                 $userData = JSON::decode(StringUtil::trim($reply['body']));
             } catch (SystemException $e) {
                 // force logging
                 $e->getExceptionID();
                 throw new IllegalLinkException();
             }
             WCF::getSession()->register('__3rdPartyProvider', 'github');
             // save data for connection
             if (WCF::getUser()->userID) {
                 WCF::getSession()->register('__githubUsername', $userData['login']);
                 WCF::getSession()->register('__githubToken', $data['access_token']);
                 HeaderUtil::redirect(LinkHandler::getInstance()->getLink('AccountManagement') . '#3rdParty');
             } else {
                 WCF::getSession()->register('__githubData', $userData);
                 WCF::getSession()->register('__username', $userData['login']);
                 // check whether user has entered a public email
                 if (isset($userData) && isset($userData['email']) && $userData['email'] !== null) {
                     WCF::getSession()->register('__email', $userData['email']);
                 } else {
                     try {
                         $request = new HTTPRequest('https://api.github.com/user/emails?access_token=' . $data['access_token']);
                         $request->execute();
                         $reply = $request->getReply();
                         $emails = JSON::decode(StringUtil::trim($reply['body']));
                         // handle future response as well a current response (see. http://developer.github.com/v3/users/emails/)
                         if (is_string($emails[0])) {
                             $email = $emails[0];
                         } else {
                             $email = $emails[0]['email'];
                             foreach ($emails as $tmp) {
                                 if ($tmp['primary']) {
                                     $email = $tmp['email'];
                                 }
                                 break;
                             }
                         }
                         WCF::getSession()->register('__email', $email);
                     } catch (SystemException $e) {
                     }
                 }
                 WCF::getSession()->register('__githubToken', $data['access_token']);
                 // we assume that bots won't register on github first
                 // thus no need for a captcha
                 if (REGISTER_USE_CAPTCHA) {
                     WCF::getSession()->register('noRegistrationCaptcha', true);
                 }
                 WCF::getSession()->update();
                 HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Register'));
             }
         }
         $this->executed();
         exit;
     }
     // user declined or any other error that may occur
     if (isset($_GET['error'])) {
         throw new NamedUserException(WCF::getLanguage()->get('wcf.user.3rdparty.github.login.error.' . $_GET['error']));
     }
     // start auth by redirecting to github
     $token = StringUtil::getRandomID();
     WCF::getSession()->register('__githubInit', $token);
     HeaderUtil::redirect("https://github.com/login/oauth/authorize?client_id=" . rawurlencode(StringUtil::trim(GITHUB_PUBLIC_KEY)) . "&scope=" . rawurlencode('user:email') . "&state=" . $token);
     $this->executed();
     exit;
 }
 /**
  * @see    \wcf\form\IForm::save()
  */
 public function save()
 {
     MessageForm::save();
     // save entry
     $data = array_merge($this->additionalFields, array('languageID' => $this->languageID, 'teaser' => $this->teaser, 'subject' => $this->subject, 'message' => $this->text, 'website' => $this->website, 'lastChangeTime' => TIME_NOW));
     $entryData = array('data' => $data, 'categoryIDs' => $this->categoryIDs, 'attachmentHandler' => $this->attachmentHandler);
     if (MODULE_TAGGING) {
         $entryData['tags'] = $this->tags;
     }
     $this->objectAction = new EntryAction(array($this->entry), 'update', $entryData);
     $this->objectAction->executeAction();
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Entry', array('application' => 'linklist', 'object' => $this->entry)));
     exit;
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     // save file
     $data = array_merge($this->additionalFields, array('entryID' => $this->entryID, 'uploadTime' => TIME_NOW, 'subject' => $this->subject, 'description' => $this->text, 'isDisabled' => WCF::getSession()->getPermission('user.filebase.canAddEntryWithoutModeration') ? 0 : 1));
     $fileData = array('data' => $data, 'entry' => $this->entry, 'fileUpload' => $this->fileUpload);
     $this->objectAction = new EntryFileAction(array(), 'create', $fileData);
     $resultValues = $this->objectAction->executeAction();
     $this->saved();
     if ($resultValues['returnValues']->isDisabled) {
         HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink('FilebaseOverview', array('application' => 'filebase')), WCF::getLanguage()->get('filebase.entry.file.moderation.redirect'), 30);
     } else {
         HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Entry', array('application' => 'filebase', 'object' => $this->entry)));
     }
     exit;
 }
示例#23
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     $data = array('title' => $this->title, 'pageID' => $this->pageID, 'parentID' => $this->parentID ?: null, 'cssClasses' => $this->cssClasses, 'showOrder' => $this->showOrder, 'position' => $this->position, 'contentData' => $this->contentData, 'contentTypeID' => $this->objectType->objectTypeID);
     $this->objectAction = new ContentAction(array(), 'create', array('data' => $data));
     $returnValues = $this->objectAction->executeAction();
     $contentID = $returnValues['returnValues']->contentID;
     $contentData = $returnValues['returnValues']->contentData;
     $update = array();
     // save polls
     if ($this->objectType->objectType == 'de.codequake.cms.content.type.poll') {
         $pollID = PollManager::getInstance()->save($returnValues['returnValues']->contentID);
         if ($pollID) {
             $contentData['pollID'] = $pollID;
         }
     }
     if (!I18nHandler::getInstance()->isPlainValue('title')) {
         I18nHandler::getInstance()->save('title', 'cms.content.title' . $contentID, 'cms.content', PACKAGE_ID);
         $update['title'] = 'cms.content.title' . $contentID;
     }
     foreach ($this->objectType->getProcessor()->multilingualFields as $field) {
         if (!I18nHandler::getInstance()->isPlainValue($field)) {
             I18nHandler::getInstance()->save($field, 'cms.content.' . $field . $contentID, 'cms.content', PACKAGE_ID);
             $contentData[$field] = 'cms.content.' . $field . $contentID;
         }
     }
     $update['contentData'] = serialize($contentData);
     if (!empty($update)) {
         $editor = new ContentEditor($returnValues['returnValues']);
         $editor->update($update);
     }
     // create revision
     $objectAction = new PageAction(array($this->pageID), 'createRevision', array('action' => 'content.create'));
     $objectAction->executeAction();
     // update search index
     $objectAction = new PageAction(array($returnValues['returnValues']->pageID), 'refreshSearchIndex');
     $objectAction->executeAction();
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('ContentList', array('application' => 'cms', 'pageID' => $this->pageID)));
 }
示例#24
0
	/**
	 * @see	wcf\form\IForm::save()
	 */
	public function save() {
		parent::save();
		
		// change user
		WCF::getSession()->changeUser($this->user);
		$this->saved();
		
		if (!empty($this->url)) {
			// append session
			if (StringUtil::indexOf($this->url, '?') !== false) $this->url .= SID_ARG_2ND_NOT_ENCODED;
			else $this->url .= SID_ARG_1ST;
			HeaderUtil::redirect($this->url);
		}
		else {
			$application = ApplicationHandler::getInstance()->getActiveApplication();
			$path = $application->getPageURL() . 'acp/' . SID_ARG_1ST;
			HeaderUtil::redirect($path);
		}
		exit;
	}
示例#25
0
 public function save()
 {
     parent::save();
     if ($this->time != '') {
         $dateTime = \DateTime::createFromFormat("Y-m-d H:i", $this->time, WCF::getUser()->getTimeZone());
     }
     $data = array('languageID' => $this->languageID, 'subject' => $this->subject, 'time' => $this->time != '' ? $dateTime->getTimestamp() : TIME_NOW, 'teaser' => $this->teaser, 'message' => $this->text, 'userID' => WCF::getUser()->userID, 'username' => WCF::getUser()->username, 'isDisabled' => $this->time != '' && $dateTime->getTimestamp() > TIME_NOW ? 1 : 0, 'enableBBCodes' => $this->enableBBCodes, 'showSignature' => $this->showSignature, 'enableHtml' => $this->enableHtml, 'enableSmilies' => $this->enableSmilies, 'imageID' => $this->imageID ?: null, 'lastChangeTime' => TIME_NOW);
     $newsData = array('data' => $data, 'tags' => array(), 'attachmentHandler' => $this->attachmentHandler, 'categoryIDs' => $this->categoryIDs);
     $newsData['tags'] = $this->tags;
     $action = new NewsAction(array(), 'create', $newsData);
     $resultValues = $action->executeAction();
     // save polls
     if (WCF::getSession()->getPermission('user.cms.news.canStartPoll') && MODULE_POLL) {
         $pollID = PollManager::getInstance()->save($resultValues['returnValues']->newsID);
         if ($pollID) {
             $editor = new NewsEditor($resultValues['returnValues']);
             $editor->update(array('pollID' => $pollID));
         }
     }
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('News', array('application' => 'cms', 'object' => $resultValues['returnValues'])));
     exit;
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     MessageForm::save();
     if (WCF::getSession()->getPermission('mod.news.canEditNewsWithoutNote') && $this->editNoteSuppress == 1) {
         $this->news->editCount = 0;
         $this->editReason = '';
         $this->news->editTime = 0;
     }
     // save the news entry
     $data = array('subject' => $this->subject, 'text' => $this->text, 'teaser' => $this->teaser, 'languageID' => $this->languageID, 'enableBBCodes' => $this->enableBBCodes, 'enableHtml' => $this->enableHtml, 'enableSmilies' => $this->enableSmilies, 'editCount' => $this->news->editCount + 1, 'editReason' => $this->editReason, 'editTime' => TIME_NOW, 'editUser' => WCF::getUser()->username, 'editReason' => $this->editReason, 'editNoteSuppress' => $this->editNoteSuppress, 'isHot' => $this->isHot);
     // delayed publication
     if ($this->enableDelayedPublication) {
         $data['isPublished'] = 0;
         $dateTime = \DateTime::createFromFormat('Y-m-d H:i', $this->publicationDate, WCF::getUser()->getTimeZone());
         $data['publicationDate'] = $dateTime->getTimestamp();
     } else {
         $data['isPublished'] = 1;
         $data['publicationDate'] = 0;
     }
     // automatic archivation
     if ($this->enableAutomaticArchiving) {
         $dateTime = \DateTime::createFromFormat('Y-m-d H:i', $this->archivingDate, WCF::getUser()->getTimeZone());
         $data['archivingDate'] = $dateTime->getTimestamp();
     } else {
         $data['archivingDate'] = 0;
     }
     // news picture
     if (NEWS_ENABLE_NEWSPICTURE && $this->pictureID) {
         $data['pictureID'] = $this->pictureID;
     }
     $newsData = array('attachmentHandler' => $this->attachmentHandler, 'categoryIDs' => $this->categoryIDs, 'data' => $data);
     if (NEWS_ENTRY_ENABLE_SOURCES) {
         $newsData['sources'] = $this->sources;
     }
     if (MODULE_TAGGING) {
         $newsData['tags'] = $this->tags;
     }
     // save poll
     if ($this->canCreatePoll()) {
         $pollID = PollManager::getInstance()->save($this->news->newsID);
         if ($pollID) {
             $newsEditor = new NewsEditor($this->news);
             $newsEditor->update(array('pollID' => $pollID));
         }
     }
     $this->objectAction = new NewsAction(array($this->news), 'update', $newsData);
     $this->objectAction->executeAction();
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('News', array('application' => 'news', 'object' => $this->news)));
     exit;
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     $data = array('subject' => $this->subject, 'time' => TIME_NOW, 'text' => $this->text, 'teaser' => $this->teaser, 'userID' => WCF::getUser()->userID ?: null, 'username' => WCF::getUser()->userID ? WCF::getUser()->username : $this->username, 'languageID' => $this->languageID, 'enableBBCodes' => $this->enableBBCodes, 'enableHtml' => $this->enableHtml, 'enableSmilies' => $this->enableSmilies, 'isActive' => 1, 'isDeleted' => 0, 'isHot' => $this->isHot, 'views' => 0);
     // delayed publication
     if ($this->enableDelayedPublication) {
         $data['isPublished'] = 0;
         $dateTime = \DateTime::createFromFormat('Y-m-d H:i', $this->publicationDate, WCF::getUser()->getTimeZone());
         $data['publicationDate'] = $dateTime->getTimestamp();
     }
     // automatic archivation
     if ($this->enableAutomaticArchiving) {
         $dateTime = \DateTime::createFromFormat('Y-m-d H:i', $this->archivingDate, WCF::getUser()->getTimeZone());
         $data['archivingDate'] = $dateTime->getTimestamp();
     }
     // news picture
     if (NEWS_ENABLE_NEWSPICTURE && $this->pictureID) {
         $data['pictureID'] = $this->pictureID;
     }
     $newsData = array('attachmentHandler' => $this->attachmentHandler, 'categoryIDs' => $this->categoryIDs, 'data' => $data);
     if (NEWS_ENTRY_ENABLE_SOURCES) {
         $newsData['sources'] = $this->sources;
     }
     if (MODULE_TAGGING) {
         $newsData['tags'] = $this->tags;
     }
     $this->objectAction = new NewsAction(array(), 'create', $newsData);
     $resultvalues = $this->objectAction->executeAction();
     $this->news = $resultvalues['returnValues'];
     // quotes
     MessageQuoteManager::getInstance()->saved();
     // polls
     if ($this->canCreatePoll()) {
         $pollID = PollManager::getInstance()->save($this->news->newsID);
         if ($pollID) {
             $newsEditor = new NewsEditor($this->news);
             $newsEditor->update(array('pollID' => $pollID));
         }
     }
     $this->saved();
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('News', array('application' => 'news', 'object' => $this->news)));
     exit;
 }
示例#28
0
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     // get additional data
     $additionalData = array();
     foreach (SearchEngine::getInstance()->getAvailableObjectTypes() as $objectTypeName => $objectType) {
         if (($data = $objectType->getAdditionalData()) !== null) {
             $additionalData[$objectTypeName] = $data;
         }
     }
     // save result in database
     $this->searchData = array('packageID' => PACKAGE_ID, 'query' => $this->query, 'results' => $this->results, 'additionalData' => $additionalData, 'sortField' => $this->sortField, 'sortOrder' => $this->sortOrder, 'nameExactly' => $this->nameExactly, 'subjectOnly' => $this->subjectOnly, 'startDate' => $this->startDate, 'endDate' => $this->endDate, 'username' => $this->username, 'userID' => $this->userID, 'selectedObjectTypes' => $this->selectedObjectTypes, 'alterable' => !$this->userID ? 1 : 0);
     if ($this->modifySearchID) {
         $this->objectAction = new SearchAction(array($this->modifySearchID), 'update', array('data' => array('searchData' => serialize($this->searchData), 'searchTime' => TIME_NOW, 'searchType' => 'messages', 'searchHash' => $this->searchHash)));
         $this->objectAction->executeAction();
     } else {
         $this->objectAction = new SearchAction(array(), 'create', array('data' => array('userID' => WCF::getUser()->userID ?: null, 'searchData' => serialize($this->searchData), 'searchTime' => TIME_NOW, 'searchType' => 'messages', 'searchHash' => $this->searchHash)));
         $resultValues = $this->objectAction->executeAction();
         $this->searchID = $resultValues['returnValues']->searchID;
     }
     // save keyword
     if (!empty($this->query)) {
         SearchKeywordManager::getInstance()->add($this->query);
     }
     $this->saved();
     // get application
     $application = 'wcf';
     if (count($this->selectedObjectTypes) == 1) {
         $objectType = SearchEngine::getInstance()->getObjectType(reset($this->selectedObjectTypes));
         if ($tmp = ApplicationHandler::getInstance()->getAbbreviation($objectType->packageID)) {
             $application = $tmp;
         }
     }
     // forward to result page
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('SearchResult', array('id' => $this->searchID, 'application' => $application), 'highlight=' . urlencode($this->query)));
     exit;
 }
 /**
  * @see	\wcf\form\IForm::save()
  */
 public function save()
 {
     MessageForm::save();
     // save message
     $data = array_merge($this->additionalFields, array('message' => $this->text, 'enableBBCodes' => $this->enableBBCodes, 'enableHtml' => $this->enableHtml, 'enableSmilies' => $this->enableSmilies, 'showSignature' => $this->showSignature));
     if ($this->conversation->isDraft && !$this->draft) {
         $data['time'] = TIME_NOW;
     }
     if (!$this->draft) {
         $data['lastEditTime'] = TIME_NOW;
         $data['editCount'] = $this->message->editCount + 1;
     }
     $messageData = array('data' => $data, 'attachmentHandler' => $this->attachmentHandler);
     $this->objectAction = new ConversationMessageAction(array($this->message), 'update', $messageData);
     $this->objectAction->executeAction();
     // update conversation
     if ($this->isFirstMessage) {
         $data = array('subject' => $this->subject, 'isDraft' => $this->draft ? 1 : 0, 'participantCanInvite' => $this->participantCanInvite);
         if ($this->draft) {
             $data['draftData'] = serialize(array('participants' => $this->participantIDs, 'invisibleParticipants' => $this->invisibleParticipantIDs));
         }
         $conversationData = array('data' => $data);
         if ($this->conversation->isDraft && !$this->draft) {
             $conversationData['participants'] = $this->participantIDs;
             $conversationData['invisibleParticipants'] = $this->invisibleParticipantIDs;
             $conversationData['data']['time'] = $conversationData['data']['lastPostTime'] = TIME_NOW;
         }
         $conversationAction = new ConversationAction(array($this->conversation), 'update', $conversationData);
         $conversationAction->executeAction();
     }
     $this->saved();
     // forward
     HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Conversation', array('object' => $this->conversation, 'messageID' => $this->messageID)) . '#message' . $this->messageID);
     exit;
 }
示例#30
0
 /**
  * @see wcf\form\IForm::save()
  */
 public function save()
 {
     parent::save();
     // change user
     WCF::getSession()->changeUser($this->user);
     $this->saved();
     if (!empty($this->url)) {
         // append session
         if (StringUtil::indexOf($this->url, '?') !== false) {
             $this->url .= SID_ARG_2ND_NOT_ENCODED;
         } else {
             $this->url .= SID_ARG_1ST;
         }
         HeaderUtil::redirect($this->url);
     } else {
         HeaderUtil::redirect('index.php' . SID_ARG_1ST);
     }
     exit;
 }