XoopsModules25x /
suico
| 1 | <?php |
||||
| 2 | /** |
||||
| 3 | * Extended User Profile |
||||
| 4 | * |
||||
| 5 | * You may not change or alter any portion of this comment or credits |
||||
| 6 | * of supporting developers from this source code or any supporting source code |
||||
| 7 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||||
| 8 | * This program is distributed in the hope that it will be useful, |
||||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
| 11 | * |
||||
| 12 | * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) |
||||
| 13 | * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html) |
||||
| 14 | * @package profile |
||||
| 15 | * @since 2.3.0 |
||||
| 16 | * @author Taiwen Jiang <[email protected]> |
||||
| 17 | */ |
||||
| 18 | |||||
| 19 | |||||
| 20 | use Xmf\Request; |
||||
| 21 | use XoopsModules\Yogurt; |
||||
| 22 | use XoopsModules\Yogurt\IndexController; |
||||
| 23 | |||||
| 24 | $GLOBALS['xoopsOption']['template_main'] = 'yogurt_email.tpl'; |
||||
| 25 | require __DIR__ . '/header.php'; |
||||
| 26 | |||||
| 27 | /** |
||||
| 28 | * Fetching numbers of groups friends videos pictures etc... |
||||
| 29 | */ |
||||
| 30 | $controller = new IndexController($xoopsDB, $xoopsUser, $xoopsModule); |
||||
|
0 ignored issues
–
show
|
|||||
| 31 | $nbSections = $controller->getNumbersSections(); |
||||
| 32 | |||||
| 33 | /* @var XoopsConfigHandler $config_handler */ |
||||
| 34 | $config_handler = xoops_getHandler('config'); |
||||
| 35 | $GLOBALS['xoopsConfigUser'] = $config_handler->getConfigsByCat(XOOPS_CONF_USER); |
||||
| 36 | |||||
| 37 | if (!$GLOBALS['xoopsUser'] || $GLOBALS['xoopsConfigUser']['allow_chgmail'] != 1) { |
||||
| 38 | redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . '/', 2, _NOPERM); |
||||
| 39 | } |
||||
| 40 | |||||
| 41 | if (!isset($_POST['submit']) || !isset($_POST['passwd'])) { |
||||
| 42 | //show change password form |
||||
| 43 | include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
||||
| 44 | $form = new XoopsThemeForm(_MD_YOGURT_CHANGEMAIL, 'emailform', $_SERVER['REQUEST_URI'], 'post', true); |
||||
| 45 | $form->addElement(new XoopsFormPassword(_US_PASSWORD, 'passwd', 15, 50), true); |
||||
| 46 | $form->addElement(new XoopsFormText(_MD_YOGURT_NEWMAIL, 'newmail', 15, 50), true); |
||||
| 47 | $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
||||
| 48 | $form->assign($GLOBALS['xoopsTpl']); |
||||
| 49 | } else { |
||||
| 50 | $myts = MyTextSanitizer::getInstance(); |
||||
| 51 | $pass = @$myts->stripSlashesGPC(trim($_POST['passwd'])); |
||||
| 52 | $email = @$myts->stripSlashesGPC(trim($_POST['newmail'])); |
||||
| 53 | $errors = array(); |
||||
| 54 | if (!password_verify($oldpass, $GLOBALS['xoopsUser']->getVar('pass', 'n'))) { |
||||
| 55 | $errors[] = _MA_YOGURT_WRONGPASSWORD; |
||||
|
0 ignored issues
–
show
|
|||||
| 56 | } |
||||
| 57 | if (!checkEmail($email)) { |
||||
| 58 | $errors[] = _US_INVALIDMAIL; |
||||
| 59 | } |
||||
| 60 | |||||
| 61 | if ($errors) { |
||||
| 62 | $msg = implode('<br>', $errors); |
||||
| 63 | } else { |
||||
| 64 | //update password |
||||
| 65 | $GLOBALS['xoopsUser']->setVar('email', trim($_POST['newmail'])); |
||||
| 66 | /* @var XoopsMemberHandler $member_handler */ |
||||
| 67 | $member_handler = xoops_getHandler('member'); |
||||
| 68 | if ($member_handler->insertUser($GLOBALS['xoopsUser'])) { |
||||
| 69 | $msg = _MD_YOGURT_EMAILCHANGED; |
||||
| 70 | |||||
| 71 | //send email to new email address |
||||
| 72 | $xoopsMailer = xoops_getMailer(); |
||||
| 73 | $xoopsMailer->useMail(); |
||||
| 74 | $xoopsMailer->setTemplateDir($GLOBALS['xoopsModule']->getVar('dirname', 'n')); |
||||
| 75 | $xoopsMailer->setTemplate('emailchanged.tpl'); |
||||
| 76 | $xoopsMailer->assign('SITENAME', $GLOBALS['xoopsConfig']['sitename']); |
||||
| 77 | $xoopsMailer->assign('ADMINMAIL', $GLOBALS['xoopsConfig']['adminmail']); |
||||
| 78 | $xoopsMailer->assign('SITEURL', XOOPS_URL . '/'); |
||||
| 79 | $xoopsMailer->assign('NEWEMAIL', $email); |
||||
| 80 | $xoopsMailer->setToEmails($email); |
||||
| 81 | $xoopsMailer->setFromEmail($GLOBALS['xoopsConfig']['adminmail']); |
||||
| 82 | $xoopsMailer->setFromName($GLOBALS['xoopsConfig']['sitename']); |
||||
| 83 | $xoopsMailer->setSubject(sprintf(_MD_YOGURT_NEWEMAIL, $GLOBALS['xoopsConfig']['sitename'])); |
||||
| 84 | $xoopsMailer->send(); |
||||
| 85 | } else { |
||||
| 86 | $msg = implode('<br>', $GLOBALS['xoopsUser']->getErrors()); |
||||
| 87 | } |
||||
| 88 | } |
||||
| 89 | redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . '/index.php?uid=' . $GLOBALS['xoopsUser']->getVar('uid'), 2, $msg); |
||||
| 90 | } |
||||
| 91 | |||||
| 92 | $xoopsOption['xoops_pagetitle'] = sprintf(_MD_YOGURT_CHANGEMAIL,$xoopsModule->getVar('name'), $controller->nameOwner); |
||||
|
0 ignored issues
–
show
It seems like
$controller->nameOwner can also be of type array and array; however, parameter $args of sprintf() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 93 | |||||
| 94 | require __DIR__ . '/footer.php'; |
||||
| 95 | require dirname(__DIR__, 2) . '/footer.php'; |
||||
| 96 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.