<?php if (!defined('VB_ENTRY')) die('Access denied.'); class vB_DataManager_PrefixSet extends vB_DataManager { var $validfields = [ 'prefixsetid' => [vB_Cleaner::TYPE_STR, vB_DataManager_Constants::REQ_YES, vB_DataManager_Constants::VF_METHOD], 'displayorder' => [vB_Cleaner::TYPE_UINT, vB_DataManager_Constants::REQ_YES], ]; var $table = 'vBForum:prefixset'; var $prefixset = []; var $info = [ 'title' => null, ]; var $keyField = 'prefixsetid'; protected function verify_prefixsetid(&$prefixsetid) { if ($prefixsetid === '') { $this->error('please_complete_required_fields'); return false; } if (!preg_match('#^[a-z0-9_]+$#i', $prefixsetid) OR $prefixsetid === '0') { $this->error('invalid_string_id_alphanumeric'); return false; } if ($this->registry->db->query_first("SELECT prefixsetid FROM " . TABLE_PREFIX . "prefixset WHERE prefixsetid = '" . $this->registry->db->escape_string($prefixsetid) . "'")) { $this->error('there_is_already_prefix_set_named_x', $prefixsetid); return false; } return true; } function pre_save($doquery = true) { if ($this->presave_called !== null) { return $this->presave_called; } if ((!$this->condition OR $this->info['title'] !== null) AND strval($this->info['title']) === '') { $this->error('please_complete_required_fields'); $this->presave_called = false; return false; } $return_value = true; $this->presave_called = $return_value; return $return_value; } function post_save_each($doquery = true) { $title = strval($this->info['title']); if ($title !== '') { $phraseLib = vB_Library::instance('phrase'); $varname = 'prefixset_' . $this->fetch_field('prefixsetid') . '_title'; $phraseLib->saveCustom('vbulletin', 'prefix', $varname, $title); } vB_Library::instance('prefix')->buildDatastore(); } protected function pre_delete($doquery = true) { throw new vB_Exception_Api('invalid_action_specified_gcpglobal'); } } 