public function &getDatabase() { if ($this->m_database) { return $this->m_database; } $db = $this->getConfig()->getValue('database', null); if ($db !== null) { $d = new ZDatabase($this, 'database'); $d->open($db); $this->setDatabase($d); return $this->m_database; } $this->triggerError('Database is not set'); }
break; } $sql = "DROP DATABASE `{$dbname}`;"; $res = mysql_query($sql); if (!$res) { $error = mysql_error(); setmsg($error, 'error', 'self'); } setmsg(t('Database deleted!'), 'notice', "db.php?task=edit&name={$user}"); //redirect("?task=edit&name=$user"); break; case 'error': break; case 'flush': $sql = "FLUSH PRIVILEGES"; mysql_query($sql); setmsg(t('FLUSH PRIVILEGES'), 'notice'); // no break needed // no break needed case 'list': default: $task = 'list'; $users = ZDatabase::getDbUsers(); break; } if (!$norender) { include template('db'); } if (is_resource($db)) { mysql_close($db); }
} // check domain if (true !== ($res = ZVhosts::chkDomain($domain))) { $err['domain'] = t('Domain Invalid.'); if ($res == 'occupied') { $err['domain'] = t('Domain Occupied.'); } $break = true; } if ($break) { break; } // execute! $r1 = ZUser::adduser_request($username, $password, $package); $r2 = ZVhosts::addvhost($username, $domain); $r3 = ZDatabase::addmysqluser($username, $password); setmsg(t('Adduser request pending. It will take a few minutes to take into effect.'), 'notice'); } break; case 'edit': $token = token(); $name = isset($_REQUEST['name']) ? $_REQUEST['name'] : ''; if (!isadmin() && $me != $name) { setmsg(t('Permission Denied.')); //break; } $name = preg_replace("/[^a-z0-9]+/i", "", $name); if (!$name) { redirect('user.php'); } $package = ZPackage::getUserPackage($name);
function addmysqluser($user, $pass) { return ZDatabase::addmysqluser($user, $pass); }