Esempio n. 1
0
 /**
  * Parses search keywords.
  * 
  * @param	string		$keywordString
  */
 protected function parseKeywords($keywordString)
 {
     // convert encoding if necessary
     if (!StringUtil::isUTF8($keywordString)) {
         $keywordString = StringUtil::convertEncoding('ISO-8859-1', 'UTF-8', $keywordString);
     }
     // remove bad wildcards
     $keywordString = preg_replace('/(?<!\\w)\\*/', '', $keywordString);
     // remove search operators
     $keywordString = preg_replace('/[\\+\\-><()~]+/', '', $keywordString);
     if (mb_substr($keywordString, 0, 1) == '"' && mb_substr($keywordString, -1) == '"') {
         // phrases search
         $keywordString = StringUtil::trim(mb_substr($keywordString, 1, -1));
         if (!empty($keywordString)) {
             $this->keywords = array_merge($this->keywords, array(StringUtil::encodeHTML($keywordString)));
         }
     } else {
         // replace word delimiters by space
         $keywordString = str_replace(array('.', ','), ' ', $keywordString);
         $keywords = ArrayUtil::encodeHTML(ArrayUtil::trim(explode(' ', $keywordString)));
         if (!empty($keywords)) {
             $this->keywords = array_merge($this->keywords, $keywords);
         }
     }
 }
 /**
  * @see	\wcf\form\IForm::readFormParameters()
  */
 public function readFormParameters()
 {
     parent::readFormParameters();
     if (isset($_POST['points']) && is_array($_POST['points'])) {
         $this->points = ArrayUtil::toIntegerArray($_POST['points']);
     }
 }
 /**
  * @see	\wcf\page\IPage::readParameters()
  */
 public function readParameters()
 {
     MessageForm::readParameters();
     if (isset($_REQUEST['categoryIDs']) && is_array($_REQUEST['categoryIDs'])) {
         $this->categoryIDs = ArrayUtil::toIntegerArray($_REQUEST['categoryIDs']);
     }
     // get the news by id
     if (isset($_REQUEST['id'])) {
         $this->entryID = intval($_REQUEST['id']);
     }
     $this->entry = new Entry($this->entryID);
     if (!$this->entry->entryID) {
         throw new IllegalLinkException();
     }
     // check news permissions
     if (!$this->entry->canEdit()) {
         throw new PermissionDeniedException();
     }
     // set attachment object id
     $this->attachmentObjectID = $this->entry->entryID;
     // polls
     if ($this->canCreatePoll()) {
         PollManager::getInstance()->setObject('de.incendium.cms.news.entry', $this->entry->entryID, $this->entry->pollID);
     }
     // get max text length
     $this->maxTextLength = WCF::getSession()->getPermission('user.news.maxTextLength');
 }
 /**
  * @see	\wcf\system\option\IOptionType::getData()
  */
 public function getData(Option $option, $newValue)
 {
     if (!is_array($newValue)) {
         $newValue = array();
     }
     return implode("\n", ArrayUtil::toIntegerArray($newValue));
 }
 /**
  * @see    \wcf\system\search\ISearchableObjectType::getConditions()
  */
 public function getConditions(IForm $form = null)
 {
     $conditionBuilder = new PreparedStatementConditionBuilder();
     // accessible category ids
     if (isset($_POST['filebaseCategoryIDs'])) {
         $this->filebaseCategoryIDs = ArrayUtil::toIntegerArray($_POST['filebaseCategoryIDs']);
     }
     $categoryIDs = FilebaseCategory::getAccessibleCategoryIDs();
     if (!empty($this->filebaseCategoryIDs)) {
         $this->filebaseCategoryIDs = array_intersect($categoryIDs, $this->filebaseCategoryIDs);
     } else {
         $this->filebaseCategoryIDs = $categoryIDs;
     }
     if (empty($this->filebaseCategoryIDs)) {
         throw new PermissionDeniedException();
     }
     $conditionBuilder->add($this->getTableName() . '.entryID IN (SELECT entryID FROM filebase' . WCF_N . '_entry_to_category WHERE categoryID IN (?))', array($this->filebaseCategoryIDs));
     // default conditions
     $conditionBuilder->add($this->getTableName() . '.isDisabled = 0');
     $conditionBuilder->add($this->getTableName() . '.isDeleted = 0');
     // language
     if (FILEBASE_ENABLE_MULTILINGUALISM && LanguageFactory::getInstance()->multilingualismEnabled() && count(WCF::getUser()->getLanguageIDs())) {
         $conditionBuilder->add('(' . $this->getTableName() . '.languageID IN (?) OR ' . $this->getTableName() . '.languageID IS NULL)', array(WCF::getUser()->getLanguageIDs()));
     }
     return $conditionBuilder;
 }
Esempio n. 6
0
	/**
	 * @see	wcf\system\option\ISearchableUserOption::getCondition()
	 */
	public function getCondition(PreparedStatementConditionBuilder &$conditions, Option $option, $value) {
		if (!is_array($value) || empty($value)) return false;
		$value = ArrayUtil::trim($value);
		if (empty($value)) return false;
		
		$conditions->add("option_value.userOption".$option->optionID." = ?", array(implode("\n", $value)));
		return true;
	}
 /**
  * @see	\wcf\system\option\IOptionType::getData()
  */
 public function getData(Option $option, $newValue)
 {
     if (!is_array($newValue)) {
         $newValue = array();
     }
     $newValue = ArrayUtil::toIntegerArray($newValue);
     sort($newValue, SORT_NUMERIC);
     return implode(',', $newValue);
 }
Esempio n. 8
0
	/**
	 * @see	wcf\action\Action::readParameters()
	 */
	public function readParameters() {
		AbstractSecureAction::readParameters();
		
		if (isset($_POST['action'])) $this->action = StringUtil::trim($_POST['action']);
		if (isset($_POST['containerData']) && is_array($_POST['containerData'])) $this->containerData = $_POST['containerData'];
		if (isset($_POST['objectIDs']) && is_array($_POST['objectIDs'])) $this->objectIDs = ArrayUtil::toIntegerArray($_POST['objectIDs']);
		if (isset($_POST['pageClassName'])) $this->pageClassName = StringUtil::trim($_POST['pageClassName']);
		if (isset($_POST['type'])) $this->type = StringUtil::trim($_POST['type']);
	}
 /**
  * @see	\wcf\form\IForm::readFormParameters()
  */
 public function readFormParameters()
 {
     parent::readFormParameters();
     if (isset($_POST['enable'])) {
         $this->enable = intval($_POST['enable']);
     }
     if (isset($_POST['languageIDs']) && is_array($_POST['languageIDs'])) {
         $this->languageIDs = ArrayUtil::toIntegerArray($_POST['languageIDs']);
     }
 }
Esempio n. 10
0
 /**
  * @see	\wcf\system\option\IOptionType::validate()
  */
 public function validate(Option $option, $newValue)
 {
     parent::validate($option, $newValue);
     if ($option->allowedbbcodepermission) {
         $disallowedBBCodes = BBCodeParser::getInstance()->validateBBCodes($newValue, explode(',', ArrayUtil::trim(WCF::getSession()->getPermission($option->allowedbbcodepermission))));
         if (!empty($disallowedBBCodes)) {
             WCF::getTPL()->assign('disallowedBBCodes', $disallowedBBCodes);
             throw new UserInputException($option->optionName, 'disallowedBBCodes');
         }
     }
 }
Esempio n. 11
0
 public function readParameters()
 {
     parent::readParameters();
     // polls
     if (MODULE_POLL & WCF::getSession()->getPermission('user.cms.news.canStartPoll')) {
         PollManager::getInstance()->setObject('de.codequake.cms.news', 0);
     }
     if (isset($_REQUEST['categoryIDs']) && is_array($_REQUEST['categoryIDs'])) {
         $this->categoryIDs = ArrayUtil::toIntegerArray($_REQUEST['categoryIDs']);
     }
 }
 /**
  * @see	\wcf\system\option\IOptionType::validate()
  */
 public function validate(Option $option, $newValue)
 {
     if (!is_array($newValue)) {
         $newValue = array();
     }
     $newValue = ArrayUtil::toIntegerArray($newValue);
     foreach ($newValue as $pageID) {
         if (PageCache::getInstance()->getPage($pageID) === null) {
             throw new UserInputException($option->optionName, 'validationFailed');
         }
     }
 }
Esempio n. 13
0
 /**
  * @see	\wcf\page\IPage::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['id'])) {
         if (is_array($_REQUEST['id'])) {
             // ?id[]=1337&id[]=9001
             $this->objectIDs = ArrayUtil::toIntegerArray($_REQUEST['id']);
         } else {
             // ?id=1337 or ?id=1337,9001
             $this->objectIDs = ArrayUtil::toIntegerArray(explode(',', $_REQUEST['id']));
         }
     }
 }
Esempio n. 14
0
 /**
  * @see	\wcf\action\IAction::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_POST['interfaceName'])) {
         $this->interfaceName = StringUtil::trim($_POST['interfaceName']);
     }
     if (isset($_POST['objectIDs']) && is_array($_POST['objectIDs'])) {
         $this->objectIDs = ArrayUtil::toIntegerArray($_POST['objectIDs']);
     }
     if (isset($_POST['parameters']) && is_array($_POST['parameters'])) {
         $this->parameters = $_POST['parameters'];
     }
 }
Esempio n. 15
0
 /**
  * @see	\wcf\form\IForm::readFormParameters()
  */
 public function readFormParameters()
 {
     parent::readFormParameters();
     if (isset($_POST['name'])) {
         $this->name = StringUtil::trim($_POST['name']);
     }
     if (isset($_POST['languageID'])) {
         $this->languageID = intval($_POST['languageID']);
     }
     // actually these are synonyms
     if (isset($_POST['tags']) && is_array($_POST['tags'])) {
         $this->synonyms = ArrayUtil::trim($_POST['tags']);
     }
 }
 public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser)
 {
     // copyright
     TeraliosBBCodesCopyright::callCopyright();
     // first attribut is icon!
     $icon = isset($openingTag['attributes'][0]) ? StringUtil::trim($openingTag['attributes'][0]) : 'fa-rebel';
     // Yes, Rebel icon as default icon! ;)
     if (substr($icon, 0, 3) != 'fa-') {
         $icon = 'fa-' . $icon;
     }
     // map attributes
     $this->mapAttributes(ArrayUtil::trim($openingTag['attributes']));
     return '<span class="icon' . ($this->size > 0 ? ' icon' . $this->size : '') . ' ' . $icon . ($this->float != 'none' ? ' iconBB' . ucfirst($this->float) : '') . ' iconBBCode"></span>';
 }
Esempio n. 17
0
 /**
  * @see	\wcf\form\IForm::readFormParameters()
  */
 public function readFormParameters()
 {
     parent::readFormParameters();
     if (isset($_POST['selectedPackages']) && is_array($_POST['selectedPackages'])) {
         $selectedPackages = ArrayUtil::toIntegerArray($_POST['selectedPackages']);
         $this->selectedPackages = array_combine($selectedPackages, $selectedPackages);
         if (isset($this->selectedPackages[0])) {
             unset($this->selectedPackages[0]);
         }
     }
     if (isset($_POST['exportCustomValues'])) {
         $this->exportCustomValues = intval($_POST['exportCustomValues']);
     }
     if (isset($_POST['languageID'])) {
         $this->languageID = intval($_POST['languageID']);
     }
 }
 /**
  * @see	\wcf\system\message\embedded\object\IMessageEmbeddedObjectHandler::parseMessage()
  */
 public function parseMessage($message)
 {
     $parsedAttachmentIDs = array_unique(ArrayUtil::toIntegerArray(array_merge(self::getFirstParameters($message, 'attach'), self::getTextParameters($message, 'attach'))));
     if (!empty($parsedAttachmentIDs)) {
         $attachmentIDs = array();
         foreach ($parsedAttachmentIDs as $parsedAttachmentID) {
             if ($parsedAttachmentID) {
                 $attachmentIDs[] = $parsedAttachmentID;
             }
         }
         if (!empty($attachmentIDs)) {
             $attachmentList = new AttachmentList();
             $attachmentList->getConditionBuilder()->add("attachment.attachmentID IN (?)", array($attachmentIDs));
             $attachmentList->readObjectIDs();
             return $attachmentList->getObjectIDs();
         }
     }
     return false;
 }
 /**
  * Returns a rendered message preview.
  * 
  * @return	array
  */
 public function getMessagePreview()
 {
     // get options
     $enableBBCodes = isset($this->parameters['options']['enableBBCodes']) ? 1 : 0;
     $enableHtml = isset($this->parameters['options']['enableHtml']) ? 1 : 0;
     $enableSmilies = isset($this->parameters['options']['enableSmilies']) ? 1 : 0;
     $preParse = isset($this->parameters['options']['preParse']) ? 1 : 0;
     $allowedBBCodesPermission = isset($this->parameters['allowedBBCodesPermission']) ? $this->parameters['allowedBBCodesPermission'] : 'user.message.allowedBBCodes';
     // validate permissions for options
     if ($enableBBCodes && !WCF::getSession()->getPermission('user.message.canUseBBCodes')) {
         $enableBBCodes = 0;
     }
     if ($enableHtml && !WCF::getSession()->getPermission('user.message.canUseHtml')) {
         $enableHtml = 0;
     }
     if ($enableSmilies && !WCF::getSession()->getPermission('user.message.canUseSmilies')) {
         $enableSmilies = 0;
     }
     // check if disallowed bbcode are used
     if ($enableBBCodes && $allowedBBCodesPermission) {
         $disallowedBBCodes = MessageParser::getInstance()->validateBBCodes($this->parameters['data']['message'], ArrayUtil::trim(explode(',', WCF::getSession()->getPermission($allowedBBCodesPermission))));
         if (!empty($disallowedBBCodes)) {
             throw new UserInputException('message', WCF::getLanguage()->getDynamicVariable('wcf.message.error.disallowedBBCodes', array('disallowedBBCodes' => $disallowedBBCodes)));
         }
     }
     // get message
     $message = StringUtil::trim($this->parameters['data']['message']);
     // get embedded objects
     MessageEmbeddedObjectManager::getInstance()->parseTemporaryMessage($message);
     // parse URLs
     if ($preParse && $enableBBCodes) {
         if ($allowedBBCodesPermission) {
             $message = PreParser::getInstance()->parse($message, ArrayUtil::trim(explode(',', WCF::getSession()->getPermission($allowedBBCodesPermission))));
         } else {
             $message = PreParser::getInstance()->parse($message);
         }
     }
     // parse message
     $preview = MessageParser::getInstance()->parse($message, $enableSmilies, $enableHtml, $enableBBCodes, false);
     return array('message' => $preview);
 }
Esempio n. 20
0
 /**
  * @see	\wcf\data\ISortableAction::validateUpdatePosition()
  */
 public function validateUpdatePosition()
 {
     // validate permissions
     WCF::getSession()->checkPermissions(array('admin.content.dashboard.canEditDashboard'));
     $this->readString('boxType');
     $this->readInteger('objectTypeID');
     // validate box type
     if (!in_array($this->parameters['boxType'], array('content', 'sidebar'))) {
         throw new UserInputException('boxType');
     }
     // validate object type
     $objectType = ObjectTypeCache::getInstance()->getObjectType($this->parameters['objectTypeID']);
     if ($objectType !== null) {
         $objectTypeDefinition = ObjectTypeCache::getInstance()->getDefinitionByName('com.woltlab.wcf.user.dashboardContainer');
         if ($objectTypeDefinition !== null) {
             if ($objectType->definitionID == $objectTypeDefinition->definitionID) {
                 $this->objectType = $objectType;
             }
         }
     }
     if ($this->objectType === null) {
         throw new UserInputException('objectTypeID');
     }
     // read all dashboard boxes of the relevant box type
     $boxList = new DashboardBoxList();
     $boxList->getConditionBuilder()->add("dashboard_box.boxType = ?", array($this->parameters['boxType']));
     $boxList->readObjects();
     $this->boxes = $boxList->getObjects();
     // parse structure
     if (isset($this->parameters['data']) & isset($this->parameters['data']['structure']) && isset($this->parameters['data']['structure'][0])) {
         $this->boxStructure = ArrayUtil::toIntegerArray($this->parameters['data']['structure'][0]);
         // validate box ids
         if (!empty($this->boxStructure)) {
             foreach ($this->boxStructure as $boxID) {
                 if (!isset($this->boxes[$boxID])) {
                     throw new UserInputException('boxID');
                 }
             }
         }
     }
 }
    /**
     * Parses given message for specific bbcode parameters.
     * 
     * @param	string		$message
     * @param	string		$bbcode		bbcode name
     * @return	array
     */
    public static function getFirstParameters($message, $bbcode)
    {
        $pattern = '~\\[' . $bbcode . '=
				(\'(?:[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'|(?:[^,\\]]*))
				(?:,(?:\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|[^,\\]]*))*
			\\]~ix';
        if (preg_match_all($pattern, $message, $matches)) {
            foreach ($matches[1] as &$value) {
                // remove quotes
                if (mb_substr($value, 0, 1) == "'" && mb_substr($value, -1) == "'") {
                    $value = str_replace("\\'", "'", $value);
                    $value = str_replace("\\\\", "\\", $value);
                    $value = mb_substr($value, 1, -1);
                }
            }
            $results = ArrayUtil::trim($matches[1]);
            $results = array_unique($results);
            return $results;
        }
        return array();
    }
 /**
  * @see \wcf\system\message\embedded\object\IMessageEmbeddedObjectHandler::parseMessage()
  */
 public function parseMessage($message)
 {
     // yes i know... but what i can do diffrent to the parent class? ;) I am only need xattach... Stupid!
     $return = false;
     $parsedIDs = array_unique(ArrayUtil::toIntegerArray(self::getFirstParameters($message, 'xattach')));
     if (!empty($parsedIDs)) {
         $attachmentIDs = array();
         foreach ($parsedIDs as $attachmentID) {
             if ($attachmentID) {
                 $attachmentIDs[] = $attachmentID;
             }
         }
         if (!empty($attachmentIDs)) {
             $attachmentList = new AttachmentList();
             $attachmentList->getConditionBuilder()->add("attachment.attachmentID IN (?)", array($attachmentIDs));
             $attachmentList->readObjectIDs();
             $return = $attachmentList->getObjectIDs();
         }
     }
     return $return;
 }
Esempio n. 23
0
 /**
  * @see wcf\form\IForm::readFormParameters()
  */
 public function readFormParameters()
 {
     parent::readFormParameters();
     if (isset($_POST['userIDs'])) {
         $this->userIDs = ArrayUtil::toIntegerArray(explode(',', $_POST['userIDs']));
     }
     if (isset($_POST['groupIDs']) && is_array($_POST['groupIDs'])) {
         $this->groupIDs = ArrayUtil::toIntegerArray($_POST['groupIDs']);
     }
     if (isset($_POST['subject'])) {
         $this->subject = StringUtil::trim($_POST['subject']);
     }
     if (isset($_POST['text'])) {
         $this->text = StringUtil::trim($_POST['text']);
     }
     if (isset($_POST['from'])) {
         $this->from = StringUtil::trim($_POST['from']);
     }
     if (isset($_POST['enableHTML'])) {
         $this->enableHTML = intval($_POST['enableHTML']);
     }
 }
Esempio n. 24
0
 /**
  * @see	\wcf\action\IAction::readParameters()
  */
 public function readParameters()
 {
     AbstractSecureAction::readParameters();
     if (isset($_POST['actionName'])) {
         $this->actionName = StringUtil::trim($_POST['actionName']);
     }
     if (isset($_POST['getFullQuoteObjectIDs'])) {
         $this->_getFullQuoteObjectIDs = intval($_POST['getFullQuoteObjectIDs']);
     }
     if (isset($_POST['objectTypes']) && is_array($_POST['objectTypes'])) {
         $this->objectTypes = ArrayUtil::trim($_POST['objectTypes']);
     }
     if (isset($_POST['quoteIDs'])) {
         $this->quoteIDs = ArrayUtil::trim($_POST['quoteIDs']);
         // validate quote ids
         foreach ($this->quoteIDs as $key => $quoteID) {
             if (MessageQuoteManager::getInstance()->getQuote($quoteID) === null) {
                 unset($this->quoteIDs[$key]);
             }
         }
     }
 }
 /**
  * @see	\wcf\system\SingletonFactory::init()
  */
 protected function init()
 {
     if (isset($_GET['highlight'])) {
         $keywordString = $_GET['highlight'];
         // remove search operators
         $keywordString = preg_replace('/[\\+\\-><()~\\*]+/', '', $keywordString);
         if (mb_substr($keywordString, 0, 1) == '"' && mb_substr($keywordString, -1) == '"') {
             // phrases search
             $keywordString = StringUtil::trim(mb_substr($keywordString, 1, -1));
             if (!empty($keywordString)) {
                 $this->searchQuery = $keywordString;
             }
         } else {
             $this->searchQuery = ArrayUtil::trim(explode(' ', $keywordString));
             if (empty($this->searchQuery)) {
                 $this->searchQuery = false;
             } else {
                 if (count($this->searchQuery) == 1) {
                     $this->searchQuery = reset($this->searchQuery);
                 }
             }
         }
     }
 }
Esempio n. 26
0
	/**
	 * @see	wcf\form\IForm::readFormParameters()
	 */
	public function readFormParameters() {
		parent::readFormParameters();
		
		if (isset($_POST['username'])) $this->username = StringUtil::trim($_POST['username']);
		if (isset($_POST['email'])) $this->email = StringUtil::trim($_POST['email']);
		if (isset($_POST['groupIDArray']) && is_array($_POST['groupIDArray'])) $this->groupIDArray = ArrayUtil::toIntegerArray($_POST['groupIDArray']);
		if (isset($_POST['languageIDArray']) && is_array($_POST['languageIDArray'])) $this->languageIDArray = ArrayUtil::toIntegerArray($_POST['languageIDArray']);
		if (isset($_POST['invertGroupIDs'])) $this->invertGroupIDs = intval($_POST['invertGroupIDs']);
		// assign to group
		if (isset($_POST['assignToGroupIDArray']) && is_array($_POST['assignToGroupIDArray'])) $this->assignToGroupIDArray = ArrayUtil::toIntegerArray($_POST['assignToGroupIDArray']);
		// export mail address
		if (isset($_POST['fileType']) && $_POST['fileType'] == 'xml') $this->fileType = $_POST['fileType'];
		if (isset($_POST['separator'])) $this->separator = $_POST['separator'];
		if (isset($_POST['textSeparator'])) $this->textSeparator = $_POST['textSeparator'];
		// send mail
		if (isset($_POST['subject'])) $this->subject = StringUtil::trim($_POST['subject']);
		if (isset($_POST['text'])) $this->text = StringUtil::trim($_POST['text']);
		if (isset($_POST['from'])) $this->from = StringUtil::trim($_POST['from']);
		if (isset($_POST['enableHTML'])) $this->enableHTML = intval($_POST['enableHTML']);
	}
 /**
  * Maps bbcode attributes to html/template attributes.
  * 
  * @param	array	$openingTag
  */
 protected function mapAttributes($openingTag)
 {
     // reset attributes
     $this->title = $this->position = '';
     $this->size = 0;
     if (isset($openingTag['attributes'])) {
         $attributes = ArrayUtil::trim($openingTag['attributes']);
         // first ist position
         if (preg_match('#^(left|right)$#i', $attributes[0])) {
             $this->position = $attributes[0];
             // Attribute 2 and 3
             if (isset($attributes[1])) {
                 // attribute is size
                 if (preg_match('#^(1|2|3|4)$#', $attributes[1])) {
                     $this->size = $attributes[1];
                     // third is title.
                     if (isset($attributes[2])) {
                         $this->title = $attributes[2];
                     }
                 } else {
                     $this->title = $attributes[1];
                     // attribute 3 must be size.
                     if (isset($attributes[2]) && preg_match('#^(1|2|3|4)$#', $attributes[2])) {
                         $this->size = $attributes[2];
                     }
                 }
             }
         } else {
             if (preg_match('#^(1|2|3|4)$#', $attributes[0])) {
                 $this->size = $attributes[0];
                 // Attribute 2 and 3
                 if (isset($attributes[1])) {
                     // attribute is position
                     if (preg_match('#^(left|right)$#si', $attributes[1])) {
                         $this->position = $attributes[1];
                         // third is title.
                         if (isset($attributes[2])) {
                             $this->title = $attributes[2];
                         }
                     } else {
                         // second is title
                         $this->title = $attributes[1];
                         // third must be size.
                         if (isset($attributes[2]) && preg_match('#^(left|right)$#i', $attributes[2])) {
                             $this->position = $attributes[2];
                         }
                     }
                 }
             } else {
                 $this->title = $attributes[0];
                 // Attribute 2 and 3
                 if (isset($attributes[1])) {
                     // second is position
                     if (preg_match('#^(left|right)$#si', $attributes[1])) {
                         $this->position = $attributes[1];
                         // third must be size.
                         if (isset($attributes[2]) && preg_match('#^(1|2|3|4)$#', $attributes[2])) {
                             $this->size = $attributes[2];
                         }
                     } else {
                         if (preg_match('#^(1|2|3|4)$#', $attributes[1])) {
                             $this->size = $attributes[1];
                             // third must be position
                             if (isset($attributes[2]) && preg_match('#^(left|right)$#i', $attributes[2])) {
                                 $this->position = $attributes[2];
                             }
                         }
                     }
                 }
             }
         }
     }
     // position check
     if (!empty($this->position)) {
         $this->position = mb_strtolower($this->position);
     }
 }
 /**
  * @see	\wcf\system\condition\ICondition::readFormParameters()
  */
 public function readFormParameters()
 {
     if (isset($_POST['languageIDs']) && is_array($_POST['languageIDs'])) {
         $this->languageIDs = ArrayUtil::toIntegerArray($_POST['languageIDs']);
     }
 }
Esempio n. 29
0
 /**
  * @see	\wcf\form\IForm::readFormParameters()
  */
 public function readFormParameters()
 {
     parent::readFormParameters();
     if (isset($_POST['selectedData']) && is_array($_POST['selectedData'])) {
         $this->selectedData = $_POST['selectedData'];
     }
     if (isset($_POST['dbHost'])) {
         $this->dbHost = StringUtil::trim($_POST['dbHost']);
     }
     if (isset($_POST['dbUser'])) {
         $this->dbUser = StringUtil::trim($_POST['dbUser']);
     }
     if (isset($_POST['dbPassword'])) {
         $this->dbPassword = $_POST['dbPassword'];
     }
     if (isset($_POST['dbName'])) {
         $this->dbName = StringUtil::trim($_POST['dbName']);
     }
     if (isset($_POST['dbPrefix'])) {
         $this->dbPrefix = StringUtil::trim($_POST['dbPrefix']);
     }
     if (isset($_POST['fileSystemPath'])) {
         $this->fileSystemPath = StringUtil::trim($_POST['fileSystemPath']);
     }
     if (isset($_POST['userMergeMode'])) {
         $this->userMergeMode = intval($_POST['userMergeMode']);
     }
     if (isset($_POST['additionalData'])) {
         $this->additionalData = ArrayUtil::trim($_POST['additionalData']);
     }
 }
Esempio n. 30
0
 /**
  * add private conversation message
  *
  * @param  Object  $oMbqEtPcMsg
  * @param  Object  $oMbqEtPc
  */
 public function addMbqEtPcMsg($oMbqEtPcMsg, $oMbqEtPc)
 {
     $oConversation = $oMbqEtPc->mbqBind['oViewableConversation']->getDecoratedObject();
     //ref wcf\form\MessageForm,wcf\form\ConversationMessageAddForm
     $oMbqEtPcMsg->msgContent->setOriValue(MessageUtil::stripCrap(StringUtil::trim($oMbqEtPcMsg->msgContent->oriValue)));
     $attachmentObjectType = 'com.woltlab.wcf.conversation.message';
     $attachmentObjectID = 0;
     $tmpHash = StringUtil::getRandomID();
     $attachmentParentObjectID = 0;
     //settings
     $preParse = $enableSmilies = $enableBBCodes = $showSignature = $enableHtml = 0;
     $preParse = 1;
     if (WCF::getSession()->getPermission('user.message.canUseSmilies')) {
         $enableSmilies = 1;
     }
     //if (WCF::getSession()->getPermission('user.message.canUseHtml')) $enableHtml = 1;
     if (WCF::getSession()->getPermission('user.message.canUseBBCodes')) {
         $enableBBCodes = 1;
     }
     $showSignature = 1;
     // get max text length
     $maxTextLength = WCF::getSession()->getPermission('user.conversation.maxLength');
     //!!! use this,is better than 0
     //begin validate
     $allowedBBCodesPermission = 'user.message.allowedBBCodes';
     //validateText
     if (empty($oMbqEtPcMsg->msgContent->oriValue)) {
         MbqError::alert('', "Need message content.", '', MBQ_ERR_APP);
     }
     // check text length
     if ($maxTextLength != 0 && StringUtil::length($oMbqEtPcMsg->msgContent->oriValue) > $maxTextLength) {
         MbqError::alert('', "Message content is too long.", '', MBQ_ERR_APP);
     }
     if ($enableBBCodes && $allowedBBCodesPermission) {
         $disallowedBBCodes = BBCodeParser::getInstance()->validateBBCodes($oMbqEtPcMsg->msgContent->oriValue, ArrayUtil::trim(explode(',', WCF::getSession()->getPermission($allowedBBCodesPermission))));
         if (!empty($disallowedBBCodes)) {
             MbqError::alert('', "Message content included disallowed bbcodes.", '', MBQ_ERR_APP);
         }
     }
     // search for censored words
     if (ENABLE_CENSORSHIP) {
         $result = Censorship::getInstance()->test($oMbqEtPcMsg->msgContent->oriValue);
         if ($result) {
             MbqError::alert('', "Found censored words in message content.", '', MBQ_ERR_APP);
         }
     }
     //language
     $languageID = NULL;
     //attachment
     if (MODULE_ATTACHMENT && $attachmentObjectType) {
         $attachmentHandler = new AttachmentHandler($attachmentObjectType, $attachmentObjectID, $tmpHash, $attachmentParentObjectID);
     }
     //save
     if ($preParse) {
         // BBCodes are enabled
         if ($enableBBCodes) {
             if ($allowedBBCodesPermission) {
                 $oMbqEtPcMsg->msgContent->setOriValue(PreParser::getInstance()->parse($oMbqEtPcMsg->msgContent->oriValue, ArrayUtil::trim(explode(',', WCF::getSession()->getPermission($allowedBBCodesPermission)))));
             } else {
                 $oMbqEtPcMsg->msgContent->setOriValue(PreParser::getInstance()->parse($oMbqEtPcMsg->msgContent->oriValue));
             }
         } else {
             $oMbqEtPcMsg->msgContent->setOriValue(PreParser::getInstance()->parse($oMbqEtPcMsg->msgContent->oriValue, array()));
         }
     }
     // save message
     $data = array('conversationID' => $oConversation->conversationID, 'message' => $oMbqEtPcMsg->msgContent->oriValue, 'time' => TIME_NOW, 'userID' => WCF::getUser()->userID, 'username' => WCF::getUser()->username, 'enableBBCodes' => $enableBBCodes, 'enableHtml' => $enableHtml, 'enableSmilies' => $enableSmilies, 'showSignature' => $showSignature);
     $messageData = array('data' => $data, 'attachmentHandler' => $attachmentHandler);
     $objectAction = new ConversationMessageAction(array(), 'create', $messageData);
     $resultValues = $objectAction->executeAction();
     if ($resultValues['returnValues']->messageID) {
         $oMbqEtPcMsg->msgId->setOriValue($resultValues['returnValues']->messageID);
     } else {
         MbqError::alert('', "Can not create topic.", '', MBQ_ERR_APP);
     }
     return $oMbqEtPcMsg;
 }