Commit 3307e7cb authored by Luke081515's avatar Luke081515
Browse files

Add checkUserMail

* Checks if you can write an email to the user
* Added config for debug
parent feafdf27
......@@ -613,6 +613,20 @@ class Core extends Password {
return true;
return false;
}
/** checkUserMail
* checks if the user has the mail feature active
* @author Luke081515
* @param $username - The username of the user
* @returs false if not or if the user does not exist, true otherwise
*/
public function checkUserMail ($username) {
$result = $this->httpRequest('action=query&format=json&list=users&usprop=emailable&ususers=' . urlencode($username), $this->job, 'GET');
if (strpos($result, "missing") !== false)
return false;
if (strpos($result, "emailable") !== false)
return true;
return false;
}
/** getCatMembers
* reads out all category members of a category, including subcategories
* works till you have more than 5000 subcategories per category
......
......@@ -282,6 +282,20 @@ class Debug extends Core {
$this->processError($e, $starttime, $endtime);
}
break;
case 'checkUserMail':
$required = array("username");
$Param = $this->getParams($required);
$this->echoNotice('Starting the function call of checkUserMail...');
$starttime = microtime(true);
try {
$ret = $this->checkUserMail($Param[0]);
$endtime = microtime(true);
$this->processFunction($ret, $endtime);
} catch (Exception $e) {
$endtime = microtime(true);
$this->processError($e, $endtime);
}
break;
// Query functions
case 'getCatMembers':
$required = array("kat");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment