diff --git a/core/constants.php b/core/constants.php
index d10f8c8..2ee092f 100644
--- a/core/constants.php
+++ b/core/constants.php
@@ -36,6 +36,7 @@
define("TBL_ITEMS_CC", "items_call_credits");
define("TBL_PAYMENTS", "payments");
define("TBL_SHOUTBOX", "shoutbox");
+define("TBL_FAMILY_JOIN", "family_join_invites");
/**
diff --git a/core/controllers/settings.php b/core/controllers/settings.php
index 897a2dd..2eff4ae 100644
--- a/core/controllers/settings.php
+++ b/core/controllers/settings.php
@@ -144,4 +144,12 @@ public function checkCaptcha()
{
return $_POST['captcha'] == "" || $_POST['captcha'] != md5($_SESSION['botcheck']);
}
+
+ public function sendMessage($subject, $message, $to)
+ {
+ global $database;
+
+ $items = array(':from' => 0, ':to' => $to, ':date' => time(), ':subject' => $subject, ':content' => $message);
+ $database->query("INSERT INTO ".TBL_MESSAGE." SET from_id = :from, to_id = :to, date = :date, subject = :subject, content = :content", $items);
+ }
}
\ No newline at end of file
diff --git a/core/controllers/user.php b/core/controllers/user.php
index 5c236b3..0d1284e 100644
--- a/core/controllers/user.php
+++ b/core/controllers/user.php
@@ -8,7 +8,7 @@ class User
public $in_jail;
public $in_family;
- public $family;
+ public $family;
public $id;
public $in_air;
@@ -59,8 +59,7 @@ private function setFamily()
$this->family->name = "-";
$this->in_family = false;
} else {
- $this->family->id = $family->id;
- $this->family->name = $family->name;
+ $this->family = $family;
$this->in_family = true;
}
@@ -365,6 +364,14 @@ public function sendMessage($to, $subject, $message)
return $error->errorSmall("Subject can not be empty.");
}
+ if (strlen($subject) < 3) {
+ return $error->errorSmall("Subject must contain 3 characters.");
+ }
+
+ if (!ctype_alnum($subject)) {// you may send ":"
+ //return $error->errorSmall("The subject may online contain letters and digits");
+ }
+
$items = array(':from_id' => $this->id, ':to_id' => $userInfo->id, ':date' => time(), ':sub' => $subject, ':mess' => $message);
$database->query(
"INSERT INTO ".TBL_MESSAGE." SET from_id = :from_id, to_id = :to_id, date = :date, subject = :sub, content = :mess",
@@ -460,4 +467,104 @@ public function attackPlayer($username, $bullets)
return $error->succesSmall("Success");
}
+
+ public function createFamily($name)
+ {
+ global $database, $error;
+
+ if (empty($name)) {
+ return $error->errorSmall("Please fill in a family name.");
+ }
+
+ if (strlen($name) > 20) {
+ return $error->errorSmall("Your family is above 20 characters, yours is ".strlen($name).".");
+ }
+
+ if (!ctype_alnum($name)) {
+ return $error->errorSmall("Your family name may only contain letters or digits.");
+ }
+
+ if ($this->stats->fid != 0) {
+ return $error->errorSmall("You're already in a family.");
+ }
+
+ $count = $database->query("SELECT id FROM ".TBL_FAMILY." WHERE name = :name", array(':name' => $name))->rowCount();
+
+ if ($count != 0) {
+ return $error->errorSmall("This family name already exists.");
+ }
+
+ $items = array(':name' => $name, ':cash' => 10, ':bank' => 100, ':power' => 100, ':creator' => $this->id, ':max' => 10);
+ $lastId = $database->query("INSERT INTO ".TBL_FAMILY." SET name = :name, cash = :cash, bank = :bank, power = :power, creator = :creator, max_members = :max", $items, true);
+
+ $items = array(':fid' => $lastId, ':uid' => $this->id);
+ $database->query("UPDATE ".TBL_INFO." SET fid = :fid WHERE uid = :uid", $items);
+
+ return $error->succesSmall("You have created the family ".$name." with success!");
+ }
+
+ public function joinFamily($fid)
+ {
+ global $database, $error;
+
+ if ($this->in_family) {
+ return $error->errorSmall("You're already in a family. If you want to join this family you first need to leave your own family.");
+ }
+
+ $items = array(':fid' => $fid);
+ $family = $database->query("SELECT join_status, max_members FROM ".TBL_FAMILY." WHERE id = :fid", $items);
+
+ if ($family->rowCount() == 0) {
+ return $error->errorSmall("This family doesn't exists.");
+ }
+
+ $family = $family->fetchObject();
+
+ $members = $database->query("SELECT fid FROM ".TBL_INFO." WHERE fid = :fid", $items)->rowCount();
+
+ if ($members >= $family->max_members) {
+ return $error->errorSmall("This family has already reached his maximum member amount.");
+ }
+
+ $items[':uid'] = $this->id;
+
+ if ($family->join_status == 1) {
+ $database->query("UPDATE ".TBL_INFO." SET fid = :fid WHERE uid = :uid", $items);
+ return $error->succesSmall("You have joined the family!");
+ } else if ($family->join_status == 2) {
+ return $error->errorSmall("This family doesn't accepts join invites.");
+ } else {
+ $database->query("INSERT INTO ".TBL_FAMILY_JOIN." SET uid = :uid, fid = :fid", $items);
+ return $error->succesSmall("An invite to join this family has been sent.");
+ }
+ }
+
+ public function leaveFamily()
+ {
+ global $database, $error;
+
+ if ($this->family->creator == $this->id) {
+ $items = array(':fid' => $this->family->id, ':uid' => $this->id);
+ $members = $database->query("SELECT fid FROM ".TBL_INFO." WHERE fid = :fid AND uid != :uid", $items)->rowCount();
+ if ($members == 0) {
+ $items = array(':fid' => 0, ':uid' => $this->id);
+ $database->query("UPDATE ".TBL_INFO." SET fid = :fid WHERE uid = :uid", $items);
+ $items = array(':fid' => $this->family->id, ':uid' => $this->id);
+ $database->query("DELETE FROM ".TBL_FAMILY." WHERE id = :fid AND creator = :uid", $items);
+ return $error->succesSmall("You have left and removed your family.");
+ } else {
+ $items = array(':fid' => $this->family->id, ':uid' => $this->id);
+ $highestPlayer = $database->query("SELECT uid FROM ".TBL_INFO." WHERE fid = :fid AND uid != :uid ORDER BY power DESC LIMIT 1", $items)->fetchObject();
+ $items = array(':uid' => $highestPlayer->uid, ':fid' => $this->family->id);
+ $database->query("UPDATE ".TBL_FAMILY." SET creator = :uid WHERE id = :fid", $items);
+ $items = array(':fid' => 0, ':uid' => $this->id);
+ $database->query("UPDATE ".TBL_INFO." SET fid = :fid WHERE uid = :uid", $items);
+ return $error->succesSmall("You have left your family.");
+ }
+ } else {
+ $items = array(':fid' => 0, ':uid' => $this->id);
+ $database->query("UPDATE ".TBL_INFO." SET fid = :fid WHERE uid = :uid", $items);
+ return $error->succesSmall("You have left your family.");
+ }
+ }
}
\ No newline at end of file
diff --git a/core/database.php b/core/database.php
index 4dcad4a..0c8be7c 100644
--- a/core/database.php
+++ b/core/database.php
@@ -464,7 +464,7 @@ public function userOnline($user) {
* @return mixed
*/
public function paginate($table, $orderBy, $start, $end) {
- $query = $this->query("SELECT * FROM ".$table." ORDER BY ".$orderBy." LIMIT ".$start.", ".$end);
+ $query = $this->query("SELECT * FROM ".$table." ORDER BY ".$orderBy." DESC LIMIT ".$start.", ".$end);
return $query->fetchAll(PDO::FETCH_OBJ);
}
@@ -473,9 +473,10 @@ public function paginate($table, $orderBy, $start, $end) {
*
* @param string $query - The query that has to be executed
* @param array $items - The placeholders (Default = empty array)
+ * @param bool $lastId
* @return bool|\PDOStatement : Query result
*/
- public function query($query, $items = array()) {
+ public function query($query, $items = array(), $lastId = false) {
try {
$stmt = $this->connection->prepare($query);
$stmt->execute($items);
@@ -484,7 +485,11 @@ public function query($query, $items = array()) {
}
if ($stmt) {
- return $stmt;
+ if ($lastId) {
+ return $this->connection->lastInsertId(TBL_FAMILY);
+ } else {
+ return $stmt;
+ }
} else {
return false;
}
diff --git a/db_dump.sql b/db_dump.sql
index fdca061..d96a1b6 100644
--- a/db_dump.sql
+++ b/db_dump.sql
@@ -3,7 +3,7 @@
-- http://www.phpmyadmin.net
--
-- Host: localhost
--- Generation Time: Nov 28, 2014 at 07:33 PM
+-- Generation Time: Nov 30, 2014 at 03:17 PM
-- Server version: 5.5.38-MariaDB-cll-lve
-- PHP Version: 5.5.17
@@ -32,6 +32,7 @@ CREATE TABLE IF NOT EXISTS `active_guests` (
PRIMARY KEY (`ip`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
-- --------------------------------------------------------
--
@@ -129,7 +130,7 @@ CREATE TABLE IF NOT EXISTS `crimes` (
`change` int(3) NOT NULL,
`icon` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;
--
-- Dumping data for table `crimes`
@@ -138,7 +139,13 @@ CREATE TABLE IF NOT EXISTS `crimes` (
INSERT INTO `crimes` (`id`, `name`, `min_payout`, `max_payout`, `change`, `icon`) VALUES
(1, 'Steal from child', 10, 100, 10, 'steal_candy.jpg'),
(2, 'Steal bycile', 50, 150, 25, 'steal_bycile.jpg'),
-(3, 'Pickpocket', 150, 300, 40, 'zakkenrollen.jpg');
+(3, 'Pickpocket', 150, 300, 40, 'zakkenrollen.jpg'),
+(4, 'Carjacking', 1000, 5000, 67, 'auto_inbreken.jpg'),
+(5, 'Truck hijacking', 5000, 15000, 82, 'vrachtwagen_kapen.jpg'),
+(6, 'Rob a jewelry store', 15000, 30000, 109, 'juwelier_overvallen.jpg'),
+(7, 'Rob a museum', 35000, 60000, 129, 'museum_inbreken.jpg'),
+(8, 'CIT robbery', 70000, 100000, 173, 'waardetransport_overvallen.jpg'),
+(9, 'Rob the bank', 150000, 300000, 200, 'bank_overvallen.jpg');
-- --------------------------------------------------------
@@ -148,7 +155,7 @@ INSERT INTO `crimes` (`id`, `name`, `min_payout`, `max_payout`, `change`, `icon`
CREATE TABLE IF NOT EXISTS `families` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(40) NOT NULL,
+ `name` varchar(20) NOT NULL,
`cash` int(11) NOT NULL,
`bank` int(11) NOT NULL,
`power` int(20) NOT NULL,
@@ -156,15 +163,22 @@ CREATE TABLE IF NOT EXISTS `families` (
`creator` int(11) NOT NULL,
`max_members` int(11) NOT NULL DEFAULT '10',
`info` text NOT NULL,
+ `join_status` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
+
+-- --------------------------------------------------------
--
--- Dumping data for table `families`
+-- Table structure for table `family_join_invites`
--
-INSERT INTO `families` (`id`, `name`, `cash`, `bank`, `power`, `bullits`, `creator`, `max_members`, `info`) VALUES
-(1, 'Staff', 10, 1000, 100, 0, 1, 10, '');
+CREATE TABLE IF NOT EXISTS `family_join_invites` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `uid` int(11) NOT NULL,
+ `fid` int(11) NOT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
-- --------------------------------------------------------
@@ -300,7 +314,7 @@ CREATE TABLE IF NOT EXISTS `menus` (
`weight` int(11) NOT NULL,
`display` tinyint(4) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=34 ;
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=36 ;
--
-- Dumping data for table `menus`
@@ -317,7 +331,7 @@ INSERT INTO `menus` (`id`, `pid`, `menu`, `link`, `weight`, `display`) VALUES
(8, 10, 'admin', 'admin/settings', 2, 1),
(9, 11, 'admin', 'admin/users', 3, 1),
(10, 12, 'crime', 'crime/crimes', 0, 1),
-(11, 13, 'family', 'family', 0, 1),
+(11, 13, 'family', 'family', 1, 1),
(12, 14, 'statistics', 'online', 0, 1),
(13, 15, 'personal', 'personal/user-edit', 2, 1),
(14, 16, 'personal', 'personal/user-info', 1, 0),
@@ -335,11 +349,13 @@ INSERT INTO `menus` (`id`, `pid`, `menu`, `link`, `weight`, `display`) VALUES
(26, 28, 'extra', 'extra/shoutbox', 0, 1),
(27, 29, 'extra', 'extra/forum', 0, 1),
(28, 30, 'casino', 'casino/crack-the-vault', 0, 1),
-(29, 31, 'family', 'family/profile', 0, 0),
+(29, 31, 'family', 'family/profile', 3, 0),
(30, 32, 'personal', 'personal/message', 0, 0),
(31, 33, 'call-credits', 'pay/failed', 0, 0),
(32, 34, 'call-credits', 'pay/success', 0, 0),
-(33, 35, 'call-credits', 'credits/payments', 0, 1);
+(33, 35, 'call-credits', 'credits/payments', 0, 1),
+(34, 36, 'family', 'family/create', 0, 1),
+(35, 37, 'family', 'family/settings', 2, 1);
-- --------------------------------------------------------
@@ -357,7 +373,7 @@ CREATE TABLE IF NOT EXISTS `messages` (
`status` tinyint(4) NOT NULL,
`from_status` tinyint(4) NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
-- --------------------------------------------------------
@@ -374,7 +390,7 @@ CREATE TABLE IF NOT EXISTS `pages` (
`jail` tinyint(4) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `link` (`link`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=36 ;
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=38 ;
--
-- Dumping data for table `pages`
@@ -397,8 +413,8 @@ INSERT INTO `pages` (`id`, `title`, `link`, `file`, `groups`, `jail`) VALUES
(16, 'User info', 'personal/user-info', 'userinfo.php', 'a:0:{}', 0),
(17, 'Airport', 'locations/airport', 'airport.php', 'a:0:{}', 1),
(18, 'Messages', 'personal/messages', 'messages.php', 'a:0:{}', 0),
-(19, 'Call Credits Market', 'call-credits', 'call-credits.php', 'a:0:{}', 0),
-(20, 'Call Credits Shop', 'call-credits/shop', 'call-credits-shop.php', 'a:0:{}', 0),
+(19, 'Credits Market', 'call-credits', 'call-credits.php', 'a:0:{}', 0),
+(20, 'Credits Shop', 'call-credits/shop', 'call-credits-shop.php', 'a:0:{}', 0),
(21, 'Shop', 'locations/shop', 'shop.php', 'a:0:{}', 1),
(22, 'Jail', 'locations/jail', 'jail.php', 'a:0:{}', 0),
(23, 'Bank', 'locations/bank', 'bank.php', 'a:0:{}', 1),
@@ -413,7 +429,9 @@ INSERT INTO `pages` (`id`, `title`, `link`, `file`, `groups`, `jail`) VALUES
(32, 'Message', 'personal/message', 'message_load.php', 'a:3:{i:0;s:1:"1";i:1;s:1:"3";i:2;s:1:"2";}', 0),
(33, 'Pay Failed', 'pay/failed', 'failed.php', 'a:0:{}', 0),
(34, 'Pay Success', 'pay/success', 'success.php', 'a:0:{}', 0),
-(35, 'Payments', 'credits/payments', 'payments.php', 'a:1:{i:0;s:1:"1";}', 0);
+(35, 'Payments', 'credits/payments', 'payments.php', 'a:1:{i:0;s:1:"1";}', 0),
+(36, 'Create family', 'family/create', 'family-create.php', 'a:0:{}', 1),
+(37, 'Family settings', 'family/settings', 'family-settings.php', 'a:0:{}', 0);
-- --------------------------------------------------------
@@ -431,7 +449,7 @@ CREATE TABLE IF NOT EXISTS `payments` (
`date_completed` int(11) NOT NULL,
`price` varchar(5) NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;
-- --------------------------------------------------------
@@ -445,7 +463,7 @@ CREATE TABLE IF NOT EXISTS `shoutbox` (
`message` varchar(600) NOT NULL,
`date` int(11) NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
-- --------------------------------------------------------
@@ -467,7 +485,7 @@ CREATE TABLE IF NOT EXISTS `users` (
`regdate` int(11) unsigned NOT NULL,
`groups` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=17 ;
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ;
-- --------------------------------------------------------
@@ -488,6 +506,8 @@ CREATE TABLE IF NOT EXISTS `users_info` (
`crime_process` int(5) NOT NULL,
`credits` int(11) NOT NULL,
`house` int(11) NOT NULL,
+ `bullets` int(11) NOT NULL,
+ `protection` int(11) NOT NULL,
UNIQUE KEY `id` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
diff --git a/files/images/crimes/auto_inbreken.jpg b/files/images/crimes/auto_inbreken.jpg
new file mode 100644
index 0000000..4360340
Binary files /dev/null and b/files/images/crimes/auto_inbreken.jpg differ
diff --git a/files/images/crimes/bank_overvallen.jpg b/files/images/crimes/bank_overvallen.jpg
new file mode 100644
index 0000000..33c3f20
Binary files /dev/null and b/files/images/crimes/bank_overvallen.jpg differ
diff --git a/files/images/crimes/juwelier_overvallen.jpg b/files/images/crimes/juwelier_overvallen.jpg
new file mode 100644
index 0000000..e85f6eb
Binary files /dev/null and b/files/images/crimes/juwelier_overvallen.jpg differ
diff --git a/files/images/crimes/museum_inbreken.jpg b/files/images/crimes/museum_inbreken.jpg
new file mode 100644
index 0000000..ec5eaad
Binary files /dev/null and b/files/images/crimes/museum_inbreken.jpg differ
diff --git a/files/images/crimes/vrachtwagen_kapen.jpg b/files/images/crimes/vrachtwagen_kapen.jpg
new file mode 100644
index 0000000..07d1da0
Binary files /dev/null and b/files/images/crimes/vrachtwagen_kapen.jpg differ
diff --git a/files/images/crimes/waardetransport_overvallen.jpg b/files/images/crimes/waardetransport_overvallen.jpg
new file mode 100644
index 0000000..3c3394e
Binary files /dev/null and b/files/images/crimes/waardetransport_overvallen.jpg differ
diff --git a/files/images/crimes/zakkenrollen.jpg b/files/images/crimes/zakkenrollen.jpg
index e69de29..cf17aca 100644
Binary files a/files/images/crimes/zakkenrollen.jpg and b/files/images/crimes/zakkenrollen.jpg differ
diff --git a/files/ingame/call-credits/payments.php b/files/ingame/call-credits/payments.php
index 3c540e8..49b707e 100644
--- a/files/ingame/call-credits/payments.php
+++ b/files/ingame/call-credits/payments.php
@@ -1,6 +1,6 @@
query("SELECT * FROM ".TBL_PAYMENTS." ORDER BY date")->fetchAll(PDO::FETCH_OBJ);
+$payments = $database->query("SELECT * FROM ".TBL_PAYMENTS." ORDER BY date DESC")->fetchAll(PDO::FETCH_OBJ);
?>
diff --git a/files/ingame/call-credits/success.php b/files/ingame/call-credits/success.php
index 95cd886..dc6a181 100644
--- a/files/ingame/call-credits/success.php
+++ b/files/ingame/call-credits/success.php
@@ -34,7 +34,7 @@
unset($_SESSION['amount']);
unset($_SESSION['hash']);
- echo "You have payed with success! Your credits have be added to your account.";
+ echo "You have payed with success! Your credits (".$_SESSION['amount'].") have be added to your account.";
} catch (PPConnectionException $e) {
echo $e->getData();
}
diff --git a/files/ingame/crime/crimes.php b/files/ingame/crime/crimes.php
index dcb5ef7..b16b07d 100644
--- a/files/ingame/crime/crimes.php
+++ b/files/ingame/crime/crimes.php
@@ -25,7 +25,7 @@
$payout = mt_rand($_aMinPayout[$crime->id], $_aMaxPayout[$crime->id]);
$newCash = $user->stats->money + $payout;
$newRankProcess = $user->stats->rank_process + 7;
- $newCrimeProcess = $user->stats->crime_process + 5;
+ $newCrimeProcess = $user->stats->crime_process + mt_rand(5, 7);
$items = array(':rank' => $newRankProcess, ':money' => $newCash, ':crime' => $newCrimeProcess, ':uid' => $user->info->id);
$database->query("UPDATE " . TBL_INFO . " SET rank_process = :rank, money = :money, crime_process = :crime WHERE uid = :uid", $items);
@@ -89,7 +89,7 @@
- Payout is between = $crime['min_payout']; ?> and = $crime['max_payout']; ?>
+ Payout is between =$settings->currencySymbol().$settings->createFormat($crime['min_payout']); ?> and =$settings->currencySymbol().$settings->createFormat($crime['max_payout']); ?>
|
diff --git a/files/ingame/extra/forum.php b/files/ingame/extra/forum.php
index e69de29..525d6be 100644
--- a/files/ingame/extra/forum.php
+++ b/files/ingame/extra/forum.php
@@ -0,0 +1 @@
+Will not be avaible in update 0.1
\ No newline at end of file
diff --git a/files/ingame/family/family-create.php b/files/ingame/family/family-create.php
new file mode 100644
index 0000000..63820cf
--- /dev/null
+++ b/files/ingame/family/family-create.php
@@ -0,0 +1,25 @@
+stats->fid != 0) {
+ echo $error->errorBig("You already are in a family!");
+} else {
+ if (isset($_POST['create_family'])) {
+ echo $user->createFamily($_POST['family_name']);
+ }
+?>
+
+joinFamily($_GET['id']);
+ } else if ($_GET['leave'] == "true") {
+ echo $user->leaveFamily();
+ }
+
$family = $database->query("SELECT * FROM ".TBL_FAMILY." WHERE id = :uid", array(':uid' => $_GET['id']))->fetchObject();
$owner = $database->query("SELECT username FROM ".TBL_USERS." WHERE id = :uid", array(':uid' => $family->creator))->fetchObject();
$members = $database->query("SELECT uid FROM ".TBL_INFO." WHERE fid = :fid", array(':fid' => $family->id));
+
+ if ($_GET['id'] != $user->family->id) {
+ echo '';
+ } else {
+ echo '';
+ }
?>
+
Creator: |
diff --git a/files/ingame/family/family-settings.php b/files/ingame/family/family-settings.php
new file mode 100644
index 0000000..e7bc4be
--- /dev/null
+++ b/files/ingame/family/family-settings.php
@@ -0,0 +1,71 @@
+family->id == 0) {
+ echo $error->errorBig("You're not in a family!");
+ } else {
+ if (isset($_GET['accept'])) {
+ $invite = $database->query("SELECT uid FROM ".TBL_FAMILY_JOIN." WHERE id = :id", array(':id' => $_GET['accept']))->fetchObject();
+ if ($invite == false) {
+ echo $error->errorSmall("This invite doesn't exists.");
+ } else {
+ $database->query("UPDATE " . TBL_INFO . " SET fid = :fid WHERE uid = :uid", array(':fid' => $user->family->id, ':uid' => $invite->uid));
+ $settings->sendMessage("Family invite accepted.", "Your family invite has been accepted.", $invite->uid);
+ $database->query("DELETE FROM " . TBL_FAMILY_JOIN . " WHERE id = :id", array(':id' => $_GET['accept']));
+ $database->query("DELETE FROM " . TBL_FAMILY_JOIN . " WHERE uid = :uid", array(':uid' => $invite->uid));
+ echo $error->succesSmall("Invite accepted.");
+ }
+ } else if (isset($_GET['decline'])) {
+ if ($invite == false) {
+ echo $error->errorSmall("This invite doesn't exists.");
+ } else {
+ $invite = $database->query("SELECT uid FROM " . TBL_FAMILY_JOIN . " WHERE id = :id", array(':id' => $_GET['decline']))->fetchObject();
+ $settings->sendMessage("Family invite refused.", "Your family invite has been refused.", $invite->uid);
+ $database->query("DELETE FROM " . TBL_FAMILY_JOIN . " WHERE id = :id", array(':id' => $_GET['decline']));
+ $database->query("DELETE FROM " . TBL_FAMILY_JOIN . " WHERE uid = :uid", array(':uid' => $invite->uid));
+ echo $error->succesSmall("Invite refused.");
+ }
+ }
+?>
+
+
+
+ Family player join invites
+ |
+
+
+
+ Player
+ |
+
+ Options
+ |
+
+ query("SELECT * FROM ".TBL_FAMILY_JOIN." WHERE fid = :fid", array(':fid' => $user->family->id))->fetchAll(PDO::FETCH_OBJ);
+ foreach($invites as $invite) {
+ $username = $database->getUserInfoById($invite->uid)->username;
+ ?>
+
+
+
+ |
+
+ =$username; ?>
+ |
+
+
+ |
+
+ Accept
+ |
+
+
+ |
+
+ Decline
+ |
+
+
+
+ 1, ':id' => $message->id);
$database->query("UPDATE ".TBL_MESSAGE." SET status = :status WHERE id = :id", $items);
}
- $from = $database->getUserInfoById($message->from_id)->username;
+ if ($message->from_id == 0) {
+ $from = " * SYSTEM * ";
+ } else {
+ $from = $database->getUserInfoById($message->from_id)->username;
+ }
?>
diff --git a/files/ingame/personal/messages.php b/files/ingame/personal/messages.php
index 066c079..1a6953f 100644
--- a/files/ingame/personal/messages.php
+++ b/files/ingame/personal/messages.php
@@ -36,7 +36,11 @@
getInbox() as $message) {
- $from = $database->getUserInfoById($message->from_id)->username;
+ if ($message->from_id == 0) {
+ $from = " * SYSTEM * ";
+ } else {
+ $from = $database->getUserInfoById($message->from_id)->username;
+ }
?>
|