/** * @see wcf\data\DatabaseObjectEditor::create() */ public function update(array $parameters = array()) { if (isset($parameters['userID']) && !$parameters['userID']) { $parameters['userID'] = null; } return parent::update($parameters); }
/** * @see \wcf\data\IEditableObject::deleteAll() */ public static function deleteAll(array $objectIDs = array()) { $returnValue = parent::deleteAll($objectIDs); foreach ($objectIDs as $objectID) { WCF::getDB()->getEditor()->dropColumn('wcf' . WCF_N . '_user_option_value', 'userOption' . $objectID); } return $returnValue; }
/** * @see wcf\data\IEditableObject::create() */ public static function create(array $parameters = array()) { // obtain default values if (!isset($parameters['packageID'])) { $parameters['packageID'] = PACKAGE_ID; } parent::create($parameters); }
/** * @see \wcf\data\IEditableObject::delete() */ public function delete() { // update show order $sql = "UPDATE\twcf" . WCF_N . "_user_profile_menu_item\n\t\t\tSET\tshowOrder = showOrder - 1\n\t\t\tWHERE\tshowOrder >= ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($this->showOrder)); parent::delete(); }
/** * @see \wcf\data\IEditableObject::deleteAll() */ public static function deleteAll(array $objectIDs = array()) { $count = parent::deleteAll($objectIDs); // remove ACL values $objectTypeID = ACLHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.label'); ACLHandler::getInstance()->removeValues($objectTypeID, $objectIDs); return $count; }
/** * @see \wcf\data\IEditableObject::create() */ public static function create(array $parameters = array()) { $descriptions = array(); if (isset($parameters['description']) && is_array($parameters['description'])) { if (count($parameters['description']) > 1) { $descriptions = $parameters['description']; $parameters['description'] = ''; } else { $parameters['description'] = reset($parameters['description']); } } $cronjob = parent::create($parameters); // save cronjob description if (!empty($descriptions)) { // set default value if (isset($descriptions[''])) { $defaultValue = $descriptions['']; } else { if (isset($descriptions['en'])) { // fallback to English $defaultValue = $descriptions['en']; } else { if (isset($descriptions[WCF::getLanguage()->getFixedLanguageCode()])) { // fallback to the language of the current user $defaultValue = $descriptions[WCF::getLanguage()->getFixedLanguageCode()]; } else { // fallback to first description $defaultValue = reset($descriptions); } } } // fetch data directly from database during framework installation if (!PACKAGE_ID) { $sql = "SELECT\t*\n\t\t\t\t\tFROM\twcf" . WCF_N . "_language_category\n\t\t\t\t\tWHERE\tlanguageCategory = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array('wcf.acp.cronjob')); $languageCategory = $statement->fetchObject('wcf\\data\\language\\category\\LanguageCategory'); $languages = new LanguageList(); $languages->readObjects(); } else { $languages = LanguageFactory::getInstance()->getLanguages(); $languageCategory = LanguageFactory::getInstance()->getCategory('wcf.acp.cronjob'); } $sql = "INSERT INTO\twcf" . WCF_N . "_language_item\n\t\t\t\t\t\t(languageID, languageItem, languageItemValue, languageCategoryID, packageID)\n\t\t\t\tVALUES\t\t(?, ?, ?, ?, ?)\n\t\t\t\tON DUPLICATE KEY UPDATE languageItemValue = VALUES(languageItemValue)"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($languages as $language) { $value = $defaultValue; if (isset($descriptions[$language->languageCode])) { $value = $descriptions[$language->languageCode]; } $statement->execute(array($language->languageID, 'wcf.acp.cronjob.description.cronjob' . $cronjob->cronjobID, $value, $languageCategory->languageCategoryID, $cronjob->packageID)); } // update cronjob $cronjobEditor = new CronjobEditor($cronjob); $cronjobEditor->update(array('description' => 'wcf.acp.cronjob.description.cronjob' . $cronjob->cronjobID)); } return $cronjob; }
/** * Deletes this template group. */ public function delete() { // update children $sql = "UPDATE\twcf" . WCF_N . "_template_group\n\t\t\tSET\tparentTemplateGroupID = ?\n\t\t\tWHERE\tparentTemplateGroupID = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array($this->parentTemplateGroupID, $this->templateGroupID)); parent::delete(); $this->deleteFolders(); }
/** * @see wcf\data\IEditableObject::update() */ public function update(array $parameters = array()) { parent::update($parameters); // alter the table "wcf".WCF_N."_user_option_value" with this new option WCF::getDB()->getEditor()->alterColumn( 'wcf'.WCF_N.'_user_option_value', 'userOption'.$this->optionID, 'userOption'.$this->optionID, self::getColumnDefinition($parameters['optionType']) ); }
/** * @see \wcf\data\IEditableObject::deleteAll() */ public static function deleteAll(array $objectIDs = array()) { $list = new NewsPictureList(); $list->setObjectIDs($objectIDs); $list->readObjects(); foreach ($list as $object) { $editor = new NewsPictureEditor($object); $editor->deletePicture(); } return parent::deleteAll($objectIDs); }
/** * @see \wcf\data\IEditableObject::deleteAll() */ public static function deleteAll(array $objectIDs = array()) { $sql = "SELECT\t*\n\t\t\tFROM\twcf" . WCF_N . "_user_avatar\n\t\t\tWHERE\tavatarID IN (" . str_repeat('?,', count($objectIDs) - 1) . "?)"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($objectIDs); while ($avatar = $statement->fetchObject(self::$baseClass)) { $editor = new UserAvatarEditor($avatar); $editor->deleteFiles(); } return parent::deleteAll($objectIDs); }
/** * @see \wcf\data\IEditableObject::deleteAll() */ public static function deleteAll(array $objectIDs = array()) { $list = new TemplateGroupList(); $list->setObjectIDs($objectIDs); $list->readObjects(); foreach ($list as $object) { $editor = new TemplateGroupEditor($object); $editor->deleteFolder(); } return parent::deleteAll($objectIDs); }
/** * @see \wcf\data\IEditableObject::deleteAll() */ public static function deleteAll(array $objectIDs = array()) { $fileList = new FileList(); $fileList->setObjectIDs($objectIDs); $fileList->readObjects(); foreach ($fileList as $object) { $fileEditor = new FileEditor($object); $fileEditor->deleteFile(); } return parent::deleteAll($objectIDs); }
/** * @see \wcf\data\DatabaseObjectEditor::__deleteAll() */ public static function deleteAll(array $objectIDs = array()) { $returnValue = parent::deleteAll($objectIDs); // remove user to group assignments self::removeGroupAssignments($objectIDs); // remove group option values self::removeOptionValues($objectIDs); foreach ($objectIDs as $objectID) { self::updateAccessibleGroups($objectID, true); } return $returnValue; }
/** * @see \wcf\data\DatabaseObjectEditor::update() */ public function update(array $parameters = array()) { // update salt and create new password hash if (isset($parameters['password']) && $parameters['password'] !== '') { $parameters['password'] = PasswordUtil::getDoubleSaltedHash($parameters['password']); $parameters['accessToken'] = StringUtil::getRandomID(); // update accessToken $this->accessToken = $parameters['accessToken']; } else { unset($parameters['password'], $parameters['accessToken']); } parent::update($parameters); }
/** * @see \wcf\data\IEditableObject::deleteAll() */ public static function deleteAll(array $objectIDs = array()) { // delete files first $conditionBuilder = new PreparedStatementConditionBuilder(); $conditionBuilder->add("uploadID IN (?)", array($objectIDs)); $sql = "SELECT\t*\n\t\t\tFROM\tfilebase" . WCF_N . "_upload\n\t\t\t" . $conditionBuilder; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute($conditionBuilder->getParameters()); while ($upload = $statement->fetchObject(static::$baseClass)) { $editor = new FileUploadEditor($upload); $editor->deleteFile(); } return parent::deleteAll($objectIDs); }
/** * @see wcf\data\IEditableObject::delete() */ public function delete() { // update show order $sql = "UPDATE wcf".WCF_N."_page_menu_item SET showOrder = showOrder - 1 WHERE showOrder >= ? AND menuPosition = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array( $this->showOrder, $this->menuPosition )); parent::delete(); }
/** * @see wcf\data\IEditableObject::create() */ public static function create(array $parameters = array()) { $variables = null; if (isset($parameters['variables'])) { $variables = $parameters['variables']; unset($parameters['variables']); } // default values if (!isset($parameters['packageID'])) { $parameters['packageID'] = PACKAGE_ID; } if (!isset($parameters['styleDate'])) { $parameters['styleDate'] = gmdate('Y-m-d', TIME_NOW); } // save style $style = parent::create($parameters); $styleEditor = new StyleEditor($style); // save variables if ($variables !== null) { $styleEditor->setVariables($variables); } // scale preview image if (!empty($parameters['image'])) { self::scalePreviewImage(WCF_DIR . $parameters['image']); } return $style; }
/** * @see \wcf\data\IEditableObject::create() */ public static function create(array $parameters = array()) { $variables = null; if (isset($parameters['variables'])) { $variables = $parameters['variables']; unset($parameters['variables']); } // default values if (!isset($parameters['packageID'])) { $parameters['packageID'] = 1; } if (!isset($parameters['styleDate'])) { $parameters['styleDate'] = gmdate('Y-m-d', TIME_NOW); } // check if no default style is defined $sql = "SELECT\tstyleID\n\t\t\tFROM\twcf" . WCF_N . "_style\n\t\t\tWHERE\tisDefault = ?"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array(1)); $row = $statement->fetchArray(); // no default style exists if ($row === false) { $parameters['isDefault'] = 1; } // save style $style = parent::create($parameters); $styleEditor = new StyleEditor($style); // save variables if ($variables !== null) { $styleEditor->setVariables($variables); } // scale preview image if (!empty($parameters['image'])) { self::scalePreviewImage(WCF_DIR . $parameters['image']); } return $style; }
/** * @see \wcf\data\DatabaseObjectEditor::delete() */ public function delete() { parent::delete(); self::deleteLanguageFiles($this->languageID); }
/** * @see \wcf\data\IEditableObject::deleteAll() */ public static function deleteAll(array $objectIDs = array()) { $list = new TemplateList(); $list->setObjectIDs($objectIDs); $list->readObjects(); foreach ($list as $template) { $editor = new TemplateEditor($template); $editor->deleteFile(); } return parent::deleteAll($objectIDs); }
/** * @see wcf\data\IEditableObject::deleteAll() */ public static function deleteAll(array $objectIDs = array()) { // update positions $sql = "UPDATE\t" . static::getDatabaseTableName() . "\n\t\t\tSET\tshowOrder = showOrder - 1\n\t\t\tWHERE\tparentCategoryID = ?\n\t\t\t\tAND showOrder > ?"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($objectIDs as $categoryID) { $category = CategoryHandler::getInstance()->getCategory($categoryID); $statement->execute(array($category->parentCategoryID, $category->showOrder)); } return parent::deleteAll($objectIDs); }