mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-29 22:57:16 +00:00
refactor: getVSumField() in Automation replaced by direct update instead
#313
This commit is contained in:
@@ -574,46 +574,17 @@ class Automation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function culturePoints() {
|
private function culturePoints() {
|
||||||
|
global $database;
|
||||||
|
|
||||||
if(file_exists("GameEngine/Prevention/culturepoints.txt")) {
|
if(file_exists("GameEngine/Prevention/culturepoints.txt")) {
|
||||||
unlink("GameEngine/Prevention/culturepoints.txt");
|
unlink("GameEngine/Prevention/culturepoints.txt");
|
||||||
}
|
}
|
||||||
global $database,$session;
|
|
||||||
//fix by ronix
|
|
||||||
if (SPEED >10)
|
|
||||||
$speed=10;
|
|
||||||
else
|
|
||||||
$speed=SPEED;
|
|
||||||
$dur_day=86400/$speed; //24 hours/speed
|
|
||||||
if ($dur_day<3600) $dur_day=3600;
|
|
||||||
$time = time()-600; // recount every 10minutes
|
|
||||||
|
|
||||||
$array = array();
|
$database->updateVSumField('cp');
|
||||||
$q = "SELECT id, lastupdate FROM ".TB_PREFIX."users WHERE lastupdate < $time";
|
|
||||||
$array = $database->query_return($q);
|
|
||||||
|
|
||||||
// cache owner ID's, from which we'll create a grouped DB selection
|
if(file_exists("GameEngine/Prevention/culturepoints.txt")) {
|
||||||
$ownerIDs = [];
|
unlink("GameEngine/Prevention/culturepoints.txt");
|
||||||
foreach($array as $indi) {
|
}
|
||||||
if($indi['lastupdate'] <= $time && $indi['lastupdate'] > 0) {
|
|
||||||
$ownerIDs[] = $indi['id'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// get and cache the result
|
|
||||||
$ownerDatas = $database->getVSumField($ownerIDs, 'cp');
|
|
||||||
|
|
||||||
// update what's needed
|
|
||||||
$timeNow = time();
|
|
||||||
|
|
||||||
foreach ($ownerDatas as $record) {
|
|
||||||
$cp = $record['Total'] * ( $timeNow - $record['lastupdate'] ) / $dur_day;
|
|
||||||
$q = "UPDATE " . TB_PREFIX . "users set cp = cp + $cp, lastupdate = $timeNow where id = " . $record['owner'];
|
|
||||||
$database->query( $q );
|
|
||||||
}
|
|
||||||
|
|
||||||
if(file_exists("GameEngine/Prevention/culturepoints.txt")) {
|
|
||||||
unlink("GameEngine/Prevention/culturepoints.txt");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildComplete() {
|
private function buildComplete() {
|
||||||
|
|||||||
+173
-142
@@ -3542,20 +3542,51 @@ class MYSQLi_DB implements IDbConnection {
|
|||||||
return $vill;
|
return $vill;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getVSumField($uid, $field, $use_cache = true) {
|
function updateVSumField($field) {
|
||||||
list($field) = $this->escape_input($field);
|
list($field) = $this->escape_input($field);
|
||||||
|
|
||||||
|
//fix by ronix
|
||||||
|
if (SPEED >10) {
|
||||||
|
$speed = 10;
|
||||||
|
} else {
|
||||||
|
$speed = SPEED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// cultural points to gain during a day
|
||||||
|
$dur_day = (86400/SPEED);
|
||||||
|
|
||||||
|
if ($dur_day < 3600) {
|
||||||
|
$dur_day = 3600;
|
||||||
|
}
|
||||||
|
|
||||||
|
$q = "
|
||||||
|
UPDATE " . TB_PREFIX . "users as users
|
||||||
|
SET cp = cp + (
|
||||||
|
( SELECT sum($field) FROM " . TB_PREFIX . "vdata as vdata WHERE vdata.owner = users.id ".($field == 'cp' ? ' AND vdata.natar = 0' : '')." ) *
|
||||||
|
(UNIX_TIMESTAMP() - lastupdate) / $dur_day
|
||||||
|
),
|
||||||
|
lastupdate = UNIX_TIMESTAMP()
|
||||||
|
WHERE
|
||||||
|
lastupdate < (UNIX_TIMESTAMP() - 600)
|
||||||
|
"; // recount every 10 minutes
|
||||||
|
|
||||||
|
mysqli_query($this->dblink, $q) OR DIE ($q);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getVSumField($uid, $field, $use_cache = true) {
|
||||||
|
list($field) = $this->escape_input($field);
|
||||||
|
|
||||||
$array_passed = is_array($uid);
|
$array_passed = is_array($uid);
|
||||||
if (!$array_passed) {
|
if (!$array_passed) {
|
||||||
$uid = [(int) $uid];
|
$uid = [(int) $uid];
|
||||||
} else {
|
} else {
|
||||||
foreach ($uid as $index => $uidValue) {
|
foreach ($uid as $index => $uidValue) {
|
||||||
$uid[$index] = (int) $uidValue;
|
$uid[$index] = (int) $uidValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!count($uid)) {
|
if (!count($uid)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// first of all, check if we should be using cache and whether the field
|
// first of all, check if we should be using cache and whether the field
|
||||||
@@ -3564,162 +3595,162 @@ class MYSQLi_DB implements IDbConnection {
|
|||||||
return $cachedValue;
|
return $cachedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($field != "cp"){
|
if($field != "cp"){
|
||||||
$q = "SELECT owner, lastupdate, sum(" . $field . ") as Total FROM " . TB_PREFIX . "vdata where owner IN(".implode(', ', $uid).") GROUP BY owner";
|
$q = "SELECT owner, lastupdate, sum(" . $field . ") as Total FROM " . TB_PREFIX . "vdata where owner IN(".implode(', ', $uid).") GROUP BY owner";
|
||||||
}else{
|
}else{
|
||||||
$q = "SELECT owner, lastupdate, sum(" . $field . ") as Total FROM " . TB_PREFIX . "vdata where owner IN(".implode(', ', $uid).") and natar = 0 GROUP BY owner";
|
$q = "SELECT owner, lastupdate, sum(" . $field . ") as Total FROM " . TB_PREFIX . "vdata where owner IN(".implode(', ', $uid).") and natar = 0 GROUP BY owner";
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = mysqli_query($this->dblink,$q);
|
$result = mysqli_query($this->dblink,$q);
|
||||||
|
|
||||||
// return a single value
|
// return a single value
|
||||||
if (!$array_passed) {
|
if (!$array_passed) {
|
||||||
$row = mysqli_fetch_row( $result );
|
$row = mysqli_fetch_row( $result );
|
||||||
self::$userSumFieldCache[$row[0].$field] = $row[2];
|
self::$userSumFieldCache[$row[0].$field] = $row[2];
|
||||||
} else {
|
} else {
|
||||||
$result = $this->mysqli_fetch_all($result);
|
$result = $this->mysqli_fetch_all($result);
|
||||||
foreach ($result as $record) {
|
foreach ($result as $record) {
|
||||||
self::$userSumFieldCache[$record['owner'].$field] = $record['Total'];
|
self::$userSumFieldCache[$record['owner'].$field] = $record['Total'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($array_passed ? $result : self::$userSumFieldCache[$uid[0].$field]);
|
return ($array_passed ? $result : self::$userSumFieldCache[$uid[0].$field]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateVillage($vid) {
|
function updateVillage($vid) {
|
||||||
list($vid) = $this->escape_input((int) $vid);
|
list($vid) = $this->escape_input((int) $vid);
|
||||||
|
|
||||||
$time = time();
|
$time = time();
|
||||||
$q = "UPDATE " . TB_PREFIX . "vdata set lastupdate = $time where wref = $vid";
|
$q = "UPDATE " . TB_PREFIX . "vdata set lastupdate = $time where wref = $vid";
|
||||||
return mysqli_query($this->dblink,$q);
|
return mysqli_query($this->dblink,$q);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function updateOasis($vid) {
|
function updateOasis($vid) {
|
||||||
list($vid) = $this->escape_input((int) $vid);
|
list($vid) = $this->escape_input((int) $vid);
|
||||||
|
|
||||||
$time = time();
|
$time = time();
|
||||||
$q = "UPDATE " . TB_PREFIX . "odata set lastupdated = $time where wref = $vid";
|
$q = "UPDATE " . TB_PREFIX . "odata set lastupdated = $time where wref = $vid";
|
||||||
return mysqli_query($this->dblink,$q);
|
return mysqli_query($this->dblink,$q);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setVillageName($vid, $name) {
|
function setVillageName($vid, $name) {
|
||||||
list($vid, $name) = $this->escape_input((int) $vid, $name);
|
list($vid, $name) = $this->escape_input((int) $vid, $name);
|
||||||
|
|
||||||
if(!empty($name))
|
if(!empty($name))
|
||||||
{
|
{
|
||||||
$q = "UPDATE " . TB_PREFIX . "vdata set name = '$name' where wref = $vid";
|
$q = "UPDATE " . TB_PREFIX . "vdata set name = '$name' where wref = $vid";
|
||||||
return mysqli_query($this->dblink,$q);
|
return mysqli_query($this->dblink,$q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function modifyPop($vid, $pop, $mode) {
|
function modifyPop($vid, $pop, $mode) {
|
||||||
list($vid, $pop, $mode) = $this->escape_input((int) $vid, (int) $pop, $mode);
|
list($vid, $pop, $mode) = $this->escape_input((int) $vid, (int) $pop, $mode);
|
||||||
|
|
||||||
if(!$mode) {
|
if(!$mode) {
|
||||||
$q = "UPDATE " . TB_PREFIX . "vdata set pop = pop + $pop where wref = $vid";
|
$q = "UPDATE " . TB_PREFIX . "vdata set pop = pop + $pop where wref = $vid";
|
||||||
} else {
|
} else {
|
||||||
$q = "UPDATE " . TB_PREFIX . "vdata set pop = pop - $pop where wref = $vid";
|
$q = "UPDATE " . TB_PREFIX . "vdata set pop = pop - $pop where wref = $vid";
|
||||||
}
|
}
|
||||||
return mysqli_query($this->dblink,$q);
|
return mysqli_query($this->dblink,$q);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addCP($ref, $cp) {
|
function addCP($ref, $cp) {
|
||||||
list($ref, $cp) = $this->escape_input((int) $ref, (int) $cp);
|
list($ref, $cp) = $this->escape_input((int) $ref, (int) $cp);
|
||||||
|
|
||||||
$q = "UPDATE " . TB_PREFIX . "vdata set cp = cp + $cp where wref = $ref";
|
$q = "UPDATE " . TB_PREFIX . "vdata set cp = cp + $cp where wref = $ref";
|
||||||
return mysqli_query($this->dblink,$q);
|
return mysqli_query($this->dblink,$q);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addCel($ref, $cel, $type) {
|
function addCel($ref, $cel, $type) {
|
||||||
list($ref, $cel, $type) = $this->escape_input((int) $ref, (int) $cel, (int) $type);
|
list($ref, $cel, $type) = $this->escape_input((int) $ref, (int) $cel, (int) $type);
|
||||||
|
|
||||||
$q = "UPDATE " . TB_PREFIX . "vdata set celebration = $cel, type= $type where wref = $ref";
|
$q = "UPDATE " . TB_PREFIX . "vdata set celebration = $cel, type= $type where wref = $ref";
|
||||||
return mysqli_query($this->dblink,$q);
|
return mysqli_query($this->dblink,$q);
|
||||||
}
|
}
|
||||||
|
|
||||||
// no need to cache this method
|
// no need to cache this method
|
||||||
function getCel() {
|
function getCel() {
|
||||||
$time = time();
|
$time = time();
|
||||||
$q = "SELECT * FROM " . TB_PREFIX . "vdata where celebration < $time AND celebration != 0";
|
$q = "SELECT * FROM " . TB_PREFIX . "vdata where celebration < $time AND celebration != 0";
|
||||||
$result = mysqli_query($this->dblink,$q);
|
$result = mysqli_query($this->dblink,$q);
|
||||||
return $this->mysqli_fetch_all($result);
|
return $this->mysqli_fetch_all($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearCel($ref) {
|
function clearCel($ref) {
|
||||||
list($ref) = $this->escape_input((int) $ref);
|
list($ref) = $this->escape_input((int) $ref);
|
||||||
|
|
||||||
$q = "UPDATE " . TB_PREFIX . "vdata set celebration = 0, type = 0 where wref = $ref";
|
$q = "UPDATE " . TB_PREFIX . "vdata set celebration = 0, type = 0 where wref = $ref";
|
||||||
return mysqli_query($this->dblink,$q);
|
return mysqli_query($this->dblink,$q);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCelCp($user, $cp) {
|
function setCelCp($user, $cp) {
|
||||||
list($user, $cp) = $this->escape_input((int) $user, (int) $cp);
|
list($user, $cp) = $this->escape_input((int) $user, (int) $cp);
|
||||||
|
|
||||||
$q = "UPDATE " . TB_PREFIX . "users set cp = cp + $cp where id = $user";
|
$q = "UPDATE " . TB_PREFIX . "users set cp = cp + $cp where id = $user";
|
||||||
return mysqli_query($this->dblink,$q);
|
return mysqli_query($this->dblink,$q);
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearExpansionSlot($id) {
|
function clearExpansionSlot($id) {
|
||||||
$id = (int) $id;
|
$id = (int) $id;
|
||||||
|
|
||||||
$pairs = [];
|
$pairs = [];
|
||||||
for($i = 1; $i <= 3; $i++) {
|
for($i = 1; $i <= 3; $i++) {
|
||||||
$pairs[] = 'exp'.$i.' = 0';
|
$pairs[] = 'exp'.$i.' = 0';
|
||||||
}
|
}
|
||||||
|
|
||||||
$q = "UPDATE " . TB_PREFIX . "vdata SET ".implode(',', $pairs)." WHERE wref = " . $id;
|
$q = "UPDATE " . TB_PREFIX . "vdata SET ".implode(',', $pairs)." WHERE wref = " . $id;
|
||||||
mysqli_query($this->dblink,$q);
|
mysqli_query($this->dblink,$q);
|
||||||
}
|
}
|
||||||
|
|
||||||
// no need to cache this method
|
// no need to cache this method
|
||||||
function getInvitation($uid) {
|
function getInvitation($uid) {
|
||||||
list($uid) = $this->escape_input((int) $uid);
|
list($uid) = $this->escape_input((int) $uid);
|
||||||
|
|
||||||
$q = "SELECT * FROM " . TB_PREFIX . "ali_invite where uid = $uid";
|
$q = "SELECT * FROM " . TB_PREFIX . "ali_invite where uid = $uid";
|
||||||
$result = mysqli_query($this->dblink,$q);
|
$result = mysqli_query($this->dblink,$q);
|
||||||
return $this->mysqli_fetch_all($result);
|
return $this->mysqli_fetch_all($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// no need to cache this method
|
// no need to cache this method
|
||||||
function getInvitation2($uid, $aid) {
|
function getInvitation2($uid, $aid) {
|
||||||
list($uid, $aid) = $this->escape_input((int) $uid, (int) $aid);
|
list($uid, $aid) = $this->escape_input((int) $uid, (int) $aid);
|
||||||
|
|
||||||
$q = "SELECT * FROM " . TB_PREFIX . "ali_invite where uid = $uid and alliance = $aid";
|
$q = "SELECT * FROM " . TB_PREFIX . "ali_invite where uid = $uid and alliance = $aid";
|
||||||
$result = mysqli_query($this->dblink,$q);
|
$result = mysqli_query($this->dblink,$q);
|
||||||
return $this->mysqli_fetch_all($result);
|
return $this->mysqli_fetch_all($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// no need to cache this method
|
// no need to cache this method
|
||||||
function getAliInvitations($aid) {
|
function getAliInvitations($aid) {
|
||||||
list($aid) = $this->escape_input((int) $aid);
|
list($aid) = $this->escape_input((int) $aid);
|
||||||
|
|
||||||
$q = "SELECT * FROM " . TB_PREFIX . "ali_invite where alliance = $aid && accept = 0";
|
$q = "SELECT * FROM " . TB_PREFIX . "ali_invite where alliance = $aid && accept = 0";
|
||||||
$result = mysqli_query($this->dblink,$q);
|
$result = mysqli_query($this->dblink,$q);
|
||||||
return $this->mysqli_fetch_all($result);
|
return $this->mysqli_fetch_all($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendInvitation($uid, $alli, $sender) {
|
function sendInvitation($uid, $alli, $sender) {
|
||||||
list($uid, $alli, $sender) = $this->escape_input((int) $uid, (int) $alli, (int) $sender);
|
list($uid, $alli, $sender) = $this->escape_input((int) $uid, (int) $alli, (int) $sender);
|
||||||
|
|
||||||
$time = time();
|
$time = time();
|
||||||
$q = "INSERT INTO " . TB_PREFIX . "ali_invite values (0,$uid,$alli,$sender,$time,0)";
|
$q = "INSERT INTO " . TB_PREFIX . "ali_invite values (0,$uid,$alli,$sender,$time,0)";
|
||||||
return mysqli_query($this->dblink,$q);
|
return mysqli_query($this->dblink,$q);
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeInvitation($id) {
|
function removeInvitation($id) {
|
||||||
list($id) = $this->escape_input((int) $id);
|
list($id) = $this->escape_input((int) $id);
|
||||||
|
|
||||||
$q = "DELETE FROM " . TB_PREFIX . "ali_invite where id = $id";
|
$q = "DELETE FROM " . TB_PREFIX . "ali_invite where id = $id";
|
||||||
return mysqli_query($this->dblink,$q);
|
return mysqli_query($this->dblink,$q);
|
||||||
}
|
}
|
||||||
|
|
||||||
// no need to cache this method
|
// no need to cache this method
|
||||||
function getUnreadMessagesCount($uid) {
|
function getUnreadMessagesCount($uid) {
|
||||||
$uid = (int) $uid;
|
$uid = (int) $uid;
|
||||||
|
|
||||||
return mysqli_fetch_array(mysqli_query($this->dblink, '
|
return mysqli_fetch_array(mysqli_query($this->dblink, '
|
||||||
SELECT Count(*) as numUnread FROM '.TB_PREFIX.'mdata WHERE target = '.$uid.' AND viewed = 0'
|
SELECT Count(*) as numUnread FROM '.TB_PREFIX.'mdata WHERE target = '.$uid.' AND viewed = 0'
|
||||||
), MYSQLI_ASSOC)['numUnread'];
|
), MYSQLI_ASSOC)['numUnread'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3728,18 +3759,18 @@ class MYSQLi_DB implements IDbConnection {
|
|||||||
$uid = (int) $uid;
|
$uid = (int) $uid;
|
||||||
|
|
||||||
return mysqli_fetch_array(mysqli_query($this->dblink, '
|
return mysqli_fetch_array(mysqli_query($this->dblink, '
|
||||||
SELECT Count(*) as numUnread FROM '.TB_PREFIX.'ndata WHERE uid = '.$uid.' AND viewed = 0'
|
SELECT Count(*) as numUnread FROM '.TB_PREFIX.'ndata WHERE uid = '.$uid.' AND viewed = 0'
|
||||||
), MYSQLI_ASSOC)['numUnread'];
|
), MYSQLI_ASSOC)['numUnread'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendMessage($client, $owner, $topic, $message, $send, $alliance, $player, $coor, $report, $skip_escaping = false) {
|
function sendMessage($client, $owner, $topic, $message, $send, $alliance, $player, $coor, $report, $skip_escaping = false) {
|
||||||
if (!$skip_escaping) {
|
if (!$skip_escaping) {
|
||||||
list($client, $owner, $topic, $message, $send, $alliance, $player, $coor, $report) = $this->escape_input((int) $client, (int) $owner, $topic, $message, (int) $send, (int) $alliance, (int) $player, (int) $coor, (int) $report);
|
list($client, $owner, $topic, $message, $send, $alliance, $player, $coor, $report) = $this->escape_input((int) $client, (int) $owner, $topic, $message, (int) $send, (int) $alliance, (int) $player, (int) $coor, (int) $report);
|
||||||
}
|
}
|
||||||
|
|
||||||
$time = time();
|
$time = time();
|
||||||
|
|
||||||
// add this message to the query cache, so we save some queries
|
// add this message to the query cache, so we save some queries
|
||||||
// if we need to send multiple messages at once
|
// if we need to send multiple messages at once
|
||||||
self::$sendMessageQueryCache[] = "(0,$client,$owner,'$topic','$message',0,0,$send,$time,0,0,$alliance,$player,$coor,$report)";
|
self::$sendMessageQueryCache[] = "(0,$client,$owner,'$topic','$message',0,0,$send,$time,0,0,$alliance,$player,$coor,$report)";
|
||||||
|
|
||||||
@@ -3751,16 +3782,16 @@ class MYSQLi_DB implements IDbConnection {
|
|||||||
self::$sendMessageQueryCache = [];
|
self::$sendMessageQueryCache = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $retValue;
|
return $retValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendPendingMessages() {
|
public function sendPendingMessages() {
|
||||||
if (count(self::$sendMessageQueryCache)) {
|
if (count(self::$sendMessageQueryCache)) {
|
||||||
mysqli_query($this->dblink, "INSERT INTO " . TB_PREFIX . "mdata VALUES " . implode(', ', self::$sendMessageQueryCache));
|
mysqli_query($this->dblink, "INSERT INTO " . TB_PREFIX . "mdata VALUES " . implode(', ', self::$sendMessageQueryCache));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setArchived($id) {
|
function setArchived($id) {
|
||||||
if (!is_array($id)) {
|
if (!is_array($id)) {
|
||||||
$id = [$id];
|
$id = [$id];
|
||||||
|
|
||||||
@@ -3769,11 +3800,11 @@ class MYSQLi_DB implements IDbConnection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$q = "UPDATE " . TB_PREFIX . "mdata set archived = 1 where id IN(".implode(', ', $id).")";
|
$q = "UPDATE " . TB_PREFIX . "mdata set archived = 1 where id IN(".implode(', ', $id).")";
|
||||||
return mysqli_query($this->dblink,$q);
|
return mysqli_query($this->dblink,$q);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setNorm($id) {
|
function setNorm($id) {
|
||||||
if (!is_array($id)) {
|
if (!is_array($id)) {
|
||||||
$id = [$id];
|
$id = [$id];
|
||||||
|
|
||||||
@@ -3782,20 +3813,20 @@ class MYSQLi_DB implements IDbConnection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$q = "UPDATE " . TB_PREFIX . "mdata set archived = 0 where id IN(".implode(',', $id).")";
|
$q = "UPDATE " . TB_PREFIX . "mdata set archived = 0 where id IN(".implode(',', $id).")";
|
||||||
return mysqli_query($this->dblink,$q);
|
return mysqli_query($this->dblink,$q);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************
|
/***************************
|
||||||
Function to get messages
|
Function to get messages
|
||||||
Mode 1: Get inbox
|
Mode 1: Get inbox
|
||||||
Mode 2: Get sent
|
Mode 2: Get sent
|
||||||
Mode 3: Get message
|
Mode 3: Get message
|
||||||
Mode 4: Set viewed
|
Mode 4: Set viewed
|
||||||
Mode 5: Remove message
|
Mode 5: Remove message
|
||||||
Mode 6: Retrieve archive
|
Mode 6: Retrieve archive
|
||||||
References: User ID/Message ID, Mode
|
References: User ID/Message ID, Mode
|
||||||
***************************/
|
***************************/
|
||||||
// no need to cache this method
|
// no need to cache this method
|
||||||
function getMessage($id, $mode) {
|
function getMessage($id, $mode) {
|
||||||
global $session;
|
global $session;
|
||||||
|
|||||||
Reference in New Issue
Block a user