本文整理汇总了PHP中MEMBER::createFromName方法的典型用法代码示例。如果您正苦于以下问题:PHP MEMBER::createFromName方法的具体用法?PHP MEMBER::createFromName怎么用?PHP MEMBER::createFromName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MEMBER
的用法示例。
在下文中一共展示了MEMBER::createFromName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forgotPassword
/**
* Sends a new password
*/
function forgotPassword()
{
$membername = trim(postVar('name'));
if (!MEMBER::exists($membername)) {
doError(_ERROR_NOSUCHMEMBER);
}
$mem = MEMBER::createFromName($membername);
/* below keeps regular users from resetting passwords using forgot password feature
Removing for now until clear why it is required.*/
/*if (!$mem->canLogin())
doError(_ERROR_NOLOGON_NOACTIVATE);*/
// check if e-mail address is correct
if (!($mem->getEmail() == postVar('email'))) {
doError(_ERROR_INCORRECTEMAIL);
}
// send activation link
$mem->sendActivationLink('forgot');
if (postVar('url')) {
redirect(postVar('url'));
} else {
// header ("Content-Type: text/html; charset="._CHARSET);
sendContentType('text/html', '', _CHARSET);
echo _MSG_ACTIVATION_SENT;
echo '<br /><br />Return to <a href="' . $CONF['IndexURL'] . '" title="' . $CONF['SiteName'] . '">' . $CONF['SiteName'] . '</a>';
}
exit;
}
示例2: doTemplateVar
function doTemplateVar(&$item)
{
global $DIR_MEDIA, $CONF;
// see if there is a podcast file here
if (strstr($item->body . " " . $item->more, PODCAST_MARKER)) {
$mem = MEMBER::createFromName($item->author);
$id = $mem->getId();
$search = "/\"(http:\\/\\/.*?\\.(mp(e?g|2|3|4)|wm[adfvxz]|torrent))\"/i";
preg_match($search, $item->body . " " . $item->more, $result);
$mfile = explode("/", $result[1]);
$file = $DIR_MEDIA . $id . '/' . $mfile[sizeof($mfile) - 1];
if (file_exists($file)) {
$size = filesize($file);
} else {
$hdrs = array_change_key_case(get_headers($result[1], 1), CASE_LOWER);
$size = isset($hdrs['content-length']) ? $hdrs['content-length'] : 0;
}
$type = $this->get_contenttype($result[1]);
$url = $result[1];
echo "<enclosure url=\"{$url}\" length=\"{$size}\" type=\"{$type}\"/>";
}
}