Newer
Older
if(!$this->checkPerm($session_id, 'mail_filter_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../mail/form/mail_content_filter.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
}
//* wpisy filtrow e-mail
public function mail_filter_add($session_id, $client_id, $params)
{
if (!$this->checkPerm($session_id, 'mail_filter_add'))
{
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->insertQuery('../mail/form/mail_content_filter.tform.php', $client_id, $params);
return $affected_rows;
}
public function mail_filter_update($session_id, $client_id, $primary_id, $params)
{
if (!$this->checkPerm($session_id, 'mail_filter_update'))
{
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../mail/form/mail_content_filter.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
}
public function mail_filter_delete($session_id, $primary_id)
{
if (!$this->checkPerm($session_id, 'mail_filter_delete'))
{
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../mail/form/mail_content_filter.tform.php', $primary_id);
return $affected_rows;
/**
* Fetch the mail_domain record for the provided domain.
* @param int session_id
* @param string the fully qualified domain (or subdomain)
* @return array array of arrays corresponding to the mail_domain table's records
* @author till, benlake
*/
public function mail_domain_get_by_domain($session_id, $domain) {
global $app;
if(!$this->checkPerm($session_id, 'mail_domain_get_by_domain')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if (!empty($domain)) {
$sql = "SELECT * FROM mail_domain WHERE domain = ?";
$result = $app->db->queryAllRecords($sql, $domain);
return $result;
}
return false;
}
public function mail_domain_set_status($session_id, $primary_id, $status) {
global $app;
if(!$this->checkPerm($session_id, 'mail_domain_set_status')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if(in_array($status, array('active', 'inactive'))) {
if ($status == 'active') {
$status = 'y';
} else {
$status = 'n';
}
$sql = "UPDATE mail_domain SET active = ? WHERE domain_id = ?";
$app->db->query($sql, $status, $primary_id);
$result = $app->db->affectedRows();
return $result;
} else {
throw new SoapFault('status_undefined', 'The status is not available');
return false;
//** quota functions -----------------------------------------------------------------------------------
public function mailquota_get_by_user($session_id, $client_id)
{
global $app;
$app->uses('quota_lib');
if(!$this->checkPerm($session_id, 'mailquota_get_by_user')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return $app->quota_lib->get_mailquota_data($client_id, false);
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
//** xmpp functions -----------------------------------------------------------------------------------
public function xmpp_domain_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'xmpp_domain_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../mail/form/xmpp_domain.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
}
public function xmpp_domain_add($session_id, $client_id, $params)
{
if(!$this->checkPerm($session_id, 'xmpp_domain_add')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$primary_id = $this->insertQuery('../mail/form/xmpp_domain.tform.php', $client_id, $params);
return $primary_id;
}
public function xmpp_domain_update($session_id, $client_id, $primary_id, $params)
{
if(!$this->checkPerm($session_id, 'xmpp_domain_update')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->updateQuery('../mail/form/xmpp_domain.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
}
public function xmpp_domain_delete($session_id, $primary_id)
{
if(!$this->checkPerm($session_id, 'xmpp_domain_delete')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../mail/form/xmpp_domain.tform.php', $primary_id);
return $affected_rows;
}
public function xmpp_user_get($session_id, $primary_id)
{
global $app;
if(!$this->checkPerm($session_id, 'xmpp_user_get')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$app->uses('remoting_lib');
$app->remoting_lib->loadFormDef('../mail/form/xmpp_user.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
}
public function xmpp_user_add($session_id, $client_id, $params){
global $app;
if (!$this->checkPerm($session_id, 'xmpp_user_add')){
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$jid_parts = explode('@', $params['jid']);
$tmp = $app->db->queryOneRecord("SELECT domain FROM xmpp_domain WHERE domain = ?", $jid_parts[1]);
if($tmp['domain'] != $jid_parts[1]) {
throw new SoapFault('xmpp_domain_does_not_exist', 'XMPP domain - '.$jid_parts[1].' - does not exist.');
return false;
}
$affected_rows = $this->insertQuery('../mail/form/xmpp_user.tform.php', $client_id, $params);
return $affected_rows;
}
public function xmpp_user_update($session_id, $client_id, $primary_id, $params)
{
global $app;
if (!$this->checkPerm($session_id, 'xmpp_user_update'))
{
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$jid_parts = explode('@', $jid_parts['jid']);
$tmp = $app->db->queryOneRecord("SELECT domain FROM xmpp_domain WHERE domain = ?", $jid_parts[1]);
if($tmp['domain'] != $jid_parts[1]) {
throw new SoapFault('xmpp_domain_does_not_exist', 'Mail domain - '.$jid_parts[1].' - does not exist.');
return false;
}
$affected_rows = $this->updateQuery('../mail/form/xmpp_user.tform.php', $client_id, $primary_id, $params);
return $affected_rows;
}
public function xmpp_user_delete($session_id, $primary_id)
{
if (!$this->checkPerm($session_id, 'xmpp_user_delete'))
{
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
$affected_rows = $this->deleteQuery('../mail/form/xmpp_user.tform.php', $primary_id);
return $affected_rows;
}
public function xmpp_domain_get_by_domain($session_id, $domain) {
global $app;
if(!$this->checkPerm($session_id, 'xmpp_domain_get_by_domain')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if (!empty($domain)) {
$sql = "SELECT * FROM xmpp_domain WHERE domain = ?";
$result = $app->db->queryAllRecords($sql, $domain);
return $result;
}
return false;
}
public function xmpp_domain_set_status($session_id, $primary_id, $status) {
global $app;
if(!$this->checkPerm($session_id, 'xmpp_domain_set_status')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if(in_array($status, array('active', 'inactive'))) {
if ($status == 'active') {
$status = 'y';
} else {
$status = 'n';
}
$sql = "UPDATE xmpp_domain SET active = ? WHERE domain_id = ?";
$app->db->query($sql, $status, $primary_id);
$result = $app->db->affectedRows();
return $result;
} else {
throw new SoapFault('status_undefined', 'The status is not available');
return false;
}
}
public function xmpp_user_set_status($session_id, $primary_id, $status) {
global $app;
if(!$this->checkPerm($session_id, 'xmpp_user_set_status')) {
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if(in_array($status, array('active', 'inactive'))) {
if ($status == 'active') {
$status = 'y';
} else {
$status = 'n';
}
$sql = "UPDATE xmpp_user SET active = ? WHERE xmppuser_id = ?";
$app->db->query($sql, $status, $primary_id);
$result = $app->db->affectedRows();
return $result;
} else {
throw new SoapFault('status_undefined', 'The status is not available');
return false;
}
}