Hallo,
Der Folgende Code wird benutzt um verschiedene Funktionen durch einen SA-MP Server durchzuführen. Der Code und alle Funktionen funktionieren unter WBB 3.1 tadellos. Leider funktioniert unter WBB 4.1 gar nichts mehr. Was muss ich tun, damit dieser Code auch unter WBB 4.1 funktioniert? Ich bin voll am verzweifeln
PHP
<?php
// define relative dir to wbb installation
if (!defined('RELATIVE_WCF_DIR')) define('RELATIVE_WCF_DIR', '../forumalt/wcf/');
if (!defined('RELATIVE_WBB_DIR')) define('RELATIVE_WBB_DIR', '../forumalt/');
// wbb imports
require_once(RELATIVE_WBB_DIR.'global.php');
require_once(WCF_DIR.'lib/data/user/UserEditor.class.php');
require_once(WCF_DIR.'lib/data/user/User.class.php');
require_once(WCF_DIR.'lib/data/user/rank/UserRank.class.php');
class api {
private $userID;
public function __construct($userID) {
$this->userID = $userID;
}
public function getUserBanReason()
{
$user = new User($this->userID);
return $user->banReason;
}
public function banUser($Reason = '')
{
$userIDs = array ($this->userID);
$SQL = "UPDATE wcf" . WCF_N . "_user
SET banned = 1,
banReason = '" . escapeString ( $Reason ) . "'
WHERE userID IN (" . $this->userID . ")";
WCF::getDB ( )->sendQuery ( $SQL );
Session::resetSessions ( $userIDs );
return 0;
}
public function isUserBanned()
{
$user = new User($this->userID);
if($user->banned != 0)
{
return 1;
}
else
{
return 0;
}
}
public function AddUserActivityPoints($points = NULL, $userID = NULL)
{
$user = new UserRank($this->userID);
echo "0";
echo $user->updateActivityPoints($points, $userID);
}
public function userID($username = '')
{
$output = 0;
$user = new User(null, null, $username);
if($user->userID)
{
$output = $user->userID;
}
echo $output;
}
public function addUser($username = '',$password = '', $emailadress = '')
{
$output = 0;
$username = StringUtil::trim($username);
$password = StringUtil::trim($password);
$emailadress = StringUtil::trim($emailadress);
if (!UserUtil::isValidUsername($username)) {
$output = -1;
return $output;
}
if (!UserUtil::isAvailableUsername($username)) {
$output = -2;
return $output;
}
if (!UserUtil::isValidEmail($emailadress)) {
$output = -3;
return $output;
}
if (!UserUtil::isAvailableEmail($emailadress)) {
$output = -4;
return $output;
}
$user = UserEditor::create($username, $emailadress, $password, array());
if($user)
{
$output = $user->userID;
}
return $output;
}
public function checkPassword($password = '') {
$user = new User($this->userID);
$output = $user->checkPassword($password);
if(!$output) $output = '0';
return $output;
}
public function setUserToGroup($groupID = NULL) {
$output = '0';
$user = new UserEditor($this->userID);
$user->addToGroup($groupID);
return $output;
}
public function removeUserFromGroup($groupID = NULL) {
$output = '0';
$user = new UserEditor($this->userID);
$user->removeFromGroup($groupID);
return $output;
}
}
Alles anzeigen
Die FehlerMeldung bei &request=wbb_userID&userID=0&username=..
Fatal error: Class 'User' not found in C:\inetpub\wwwroot\freedom-reallife\phpwbb3\php\api.class.php on line 73
Ich hoffe ihr könnt mir helfen
Mit freundlichen Grüßen
Hammerboy