Skip to content

Commit d626541

Browse files
authored
addUserHistory (#65)
1 parent 5d296eb commit d626541

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

plugins/restapi/includes/subscribers.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,4 +579,39 @@ public static function subscriberMessages($userid=0, $email=''){
579579
}
580580
die(0);
581581
}
582+
583+
/**
584+
* Insert a new registry to user history
585+
* <p><strong>Parameters (two required):</strong><br/>
586+
* [*email] {string} email of the subscriber<br/>
587+
* [*msg] {string}
588+
* [*detail] {string}
589+
* </p>
590+
* <p><strong>Returns:</strong><br/>
591+
* Nothing
592+
* </p>
593+
*/
594+
595+
public static function subscriberAddHistory()
596+
{
597+
if (!validateEmail($_REQUEST['email'])) {
598+
Response::outputErrorMessage('invalid email address');
599+
}
600+
601+
$msg = filter_var($_REQUEST['msg'], FILTER_SANITIZE_STRING);
602+
if (empty($msg)) {
603+
Response::outputErrorMessage('msg is empty');
604+
}
605+
$detail = filter_var($_REQUEST['detail'], FILTER_SANITIZE_STRING);
606+
607+
608+
try {
609+
$response = new Response();
610+
$result = addUserHistory($_REQUEST['email'], $msg, $detail);
611+
$response->setData('messages', $result);
612+
$response->output();
613+
} catch (\Exception $e) {
614+
Response::outputError($e);
615+
}
616+
}
582617
}

0 commit comments

Comments
 (0)