/** * @see Form::save() */ public function save() { parent::save(); // save $updateOptionValueUpdate = ''; foreach ($this->activeOptions as $option) { if ($option['defaultValue'] != $option['optionValue']) { $sql = "UPDATE\twcf" . WCF_N . "_user_option\n\t\t\t\t\tSET\tdefaultValue = '" . escapeString($option['optionValue']) . "'\n\t\t\t\t\tWHERE\toptionID = " . $option['optionID']; WCF::getDB()->sendQuery($sql); if (!empty($updateOptionValueUpdate)) { $updateOptionValueUpdate .= ','; } $updateOptionValueUpdate .= 'userOption' . $option['optionID'] . "='" . escapeString($option['optionValue']) . "'"; } } // apply to existing users if ($this->applyChangesToExistingUsers == 1 && !empty($updateOptionValueUpdate)) { $sql = "UPDATE\twcf" . WCF_N . "_user_option_value\n\t\t\t\tSET\t" . $updateOptionValueUpdate; WCF::getDB()->sendQuery($sql); // reset sessions Session::resetSessions(); } // reset cache WCF::getCache()->clearResource($this->cacheName . PACKAGE_ID); // show success message WCF::getTPL()->assign('success', true); }
/** * @see Form::save() */ public function save() { parent::save(); // create require_once WCF_DIR . 'lib/data/user/group/GroupEditor.class.php'; $this->group = GroupEditor::create($this->groupName, $this->activeOptions, $this->additionalFields); $this->saved(); // show empty add form WCF::getTPL()->assign(array('success' => true, 'newGroup' => $this->group)); // reset values $this->groupName = ''; foreach ($this->activeOptions as $key => $option) { unset($this->activeOptions[$key]['optionValue']); } }
/** * @see Form::save() */ public function save() { parent::save(); // save options and affected package ids $saveOptions = $affectedPackageIDArray = array(); foreach ($this->cachedOptions as $option) { $saveOptions[$option['optionID']] = $option['optionValue']; $affectedPackageIDArray[] = $option['packageID']; } Options::save($saveOptions); // clear cache Options::resetCache(); // delete relevant options.inc.php's $affectedPackageIDArray = array_unique($affectedPackageIDArray); Options::resetFile($affectedPackageIDArray); $this->saved(); // show succes message WCF::getTPL()->assign('success', true); }
/** * @see Form::save() */ public function save() { parent::save(); $executor = AdminToolsFunctionExecution::getInstance(); $executor->setValues($this->values); $saveOptions = $this->getSaveOptions(); $inserts = ''; foreach ($saveOptions as $option) { if (!empty($inserts)) { $inserts .= ','; } $inserts .= "(" . $option['optionID'] . ", '" . escapeString($option['optionValue']) . "')"; } if (!empty($inserts)) { $sql = "INSERT INTO\twcf" . WCF_N . "_admin_tools_option\n\t\t\t\t\t\t(optionID, optionValue)\n\t\t\t\tVALUES \t\t" . $inserts . "\n\t\t\t\tON DUPLICATE KEY UPDATE optionValue = VALUES(optionValue)"; WCF::getDB()->sendQuery($sql); WCF::getCache()->clear(WCF_DIR . 'cache/', 'cache.admin_tools-option*'); } if ($this->functionID) { $executor->callFunction($this->functionID); foreach ($this->options as $superCategory) { foreach ($superCategory['categories'] as $functionCategory) { if ($functionCategory['functionID'] == $this->functionID) { $this->activeTabMenuItem = $superCategory['categoryName']; $this->activeSubTabMenuItem = $this->activeTabMenuItem . '-' . $functionCategory['categoryName']; } } } $returnMessages = WCF::getSession()->getVar('functionReturnMessage'); if (isset($returnMessages[$this->functionID])) { $functionMessage = $returnMessages[$this->functionID]; unset($returnMessages[$this->functionID]); WCF::getSession()->register('functionReturnMessage', $returnMessages); WCF::getTPL()->assign($functionMessage); } else { WCF::getTPL()->assign(array('success' => true)); } } else { WCF::getTPL()->assign(array('success' => true)); } }
/** * @see Form::save() */ public function save() { parent::save(); // store search result in database $data = serialize(array('matches' => $this->matches)); $sql = "INSERT INTO wcf" . WCF_N . "_search\n\t\t\t\t(userID, searchData,\n\t\t\t\t searchDate, searchType)\n\t\t\t\tVALUES\n\t\t\t\t(" . WCF::getUser()->userID . ", '" . escapeString($data) . "',\n\t\t\t\t " . TIME_NOW . ", 'fleets')"; unset($data); // save memory WCF::getDB()->sendQuery($sql); unset($sql); // save memory // get new search id $this->searchID = WCF::getDB()->getInsertID(); $this->saved(); // forward to result page header('Location: index.php?page=FleetList&searchID=' . $this->searchID . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED); exit; }
/** * @see Form::save() */ public function save() { parent::save(); $this->showOrder = $this->getShowOrder($this->showOrder, $this->parentMenuItem, 'parentMenuItem'); $iframeID = 0; // save iframe if ($this->useiFrame) { $sql = "INSERT INTO wcf" . WCF_N . "_admin_tools_iframe (url, width, height, borderWidth, borderColor, borderStyle)\n\t\t\t\t\tVALUES\t('" . escapeString($this->menuItemLink) . "',\n\t\t\t\t\t\t\t '" . escapeString($this->iframeWidth) . "',\n\t\t\t\t\t\t\t '" . escapeString($this->iframeHeight) . "',\n\t\t\t\t\t\t\t '" . escapeString($this->borderWidth) . "',\n\t\t\t\t\t\t\t '" . escapeString($this->borderColor) . "',\n\t\t\t\t\t\t\t '" . escapeString($this->borderStyle) . "')"; WCF::getDB()->sendQuery($sql); $iframeID = WCF::getDB()->getInsertID(); $this->menuItemLink = 'index.php?page=AdminToolsiFrame&iFrameID=' . $iframeID; } // create menu item $sql = "INSERT INTO wcf" . WCF_N . "_acp_menu_item (packageID, menuItem, menuItemLink, menuItemIcon, permissions, showOrder, parentMenuItem)\n\t\t\t\tVALUES\t(1,\n\t\t\t\t '" . escapeString($this->menuItem) . "',\n\t\t\t\t '" . escapeString($this->menuItemLink) . "',\n\t\t\t\t '" . escapeString($this->menuItemIcon) . "',\n\t\t\t\t '" . escapeString($this->permissions) . "',\n\t\t\t\t " . $this->showOrder . ",\t\t\t\t \n\t\t\t\t '" . escapeString($this->parentMenuItem) . "')"; WCF::getDB()->sendQuery($sql); if ($this->useiFrame) { $sql = "UPDATE wcf" . WCF_N . "_admin_tools_iframe SET menuItemID = " . WCF::getDB()->getInsertID() . " WHERE iframeID = " . $iframeID; WCF::getDB()->sendQuery($sql); } // create language variable if necessary if ($this->createLangVar) { $menuItemID = WCF::getDB()->getInsertID(); $name = 'wcf.acp.menu.menuItem' . $menuItemID; $value = $this->menuItem; $languages = WCF::getLanguage()->getAvailableLanguages(); foreach ($languages as $language) { $langEdit = new LanguageEditor($language['languageID']); $langEdit->updateItems(array($name => $value)); } $sql = "UPDATE wcf" . WCF_N . "_acp_menu_item\n\t\t\t\t\t\t\tSET menuItem = '" . escapeString($name) . "'\n\t\t\t\t\t\t\tWHERE menuItemID = " . $menuItemID; WCF::getDB()->sendQuery($sql); } // reset values $this->menuItem = $this->menuItemLink = $this->menuItemIcon = $this->parentMenuItem = $this->iframeHeight = $this->iframeWidth = $this->borderWidth = $this->borderColor = $this->borderStyle = ''; $this->permissions = array(); $this->showOrder = 0; WCF::getCache()->clear(WCF_DIR . 'cache/', 'cache.menu-*'); $this->saved(); WCF::getTPL()->assign(array('success' => true)); }