-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from liomj/master
Add Profile Module 1.90 features
- Loading branch information
Showing
43 changed files
with
5,148 additions
and
536 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<?php | ||
/** | ||
* Extended User Profile | ||
* | ||
* You may not change or alter any portion of this comment or credits | ||
* of supporting developers from this source code or any supporting source code | ||
* which is considered copyrighted (c) material of the original comment or credit authors. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* | ||
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) | ||
* @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html) | ||
* @package profile | ||
* @since 2.3.0 | ||
* @author Jan Pedersen | ||
* @author Taiwen Jiang <phppp@users.sourceforge.net> | ||
*/ | ||
|
||
$xoopsOption['pagetype'] = 'user'; | ||
include __DIR__ . '/header.php'; | ||
|
||
include $GLOBALS['xoops']->path('header.php'); | ||
if (!empty($_GET['id']) && !empty($_GET['actkey'])) { | ||
$id = (int)$_GET['id']; | ||
$actkey = trim($_GET['actkey']); | ||
if (empty($id)) { | ||
redirect_header(XOOPS_URL, 1, ''); | ||
} | ||
/* @var XoopsMemberHandler $member_handler */ | ||
$member_handler = xoops_getHandler('member'); | ||
$thisuser = $member_handler->getUser($id); | ||
if (!is_object($thisuser)) { | ||
redirect_header(XOOPS_URL, 1, ''); | ||
} | ||
if ($thisuser->getVar('actkey') != $actkey) { | ||
redirect_header(XOOPS_URL . '/', 5, _US_ACTKEYNOT); | ||
} else { | ||
if ($thisuser->getVar('level') > 0) { | ||
redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . '/index.php', 5, _US_ACONTACT, false); | ||
} else { | ||
if (false !== $member_handler->activateUser($thisuser)) { | ||
$xoopsPreload = XoopsPreload::getInstance(); | ||
$xoopsPreload->triggerEvent('core.behavior.user.activate', $thisuser); | ||
/* @var XoopsConfigHandler $config_handler */ | ||
$config_handler = xoops_getHandler('config'); | ||
$GLOBALS['xoopsConfigUser'] = $config_handler->getConfigsByCat(XOOPS_CONF_USER); | ||
if ($GLOBALS['xoopsConfigUser']['activation_type'] == 2) { | ||
$myts = MyTextSanitizer::getInstance(); | ||
$xoopsMailer = xoops_getMailer(); | ||
$xoopsMailer->useMail(); | ||
$xoopsMailer->setTemplate('activated.tpl'); | ||
$xoopsMailer->assign('SITENAME', $GLOBALS['xoopsConfig']['sitename']); | ||
$xoopsMailer->assign('ADMINMAIL', $GLOBALS['xoopsConfig']['adminmail']); | ||
$xoopsMailer->assign('SITEURL', XOOPS_URL . '/'); | ||
$xoopsMailer->setToUsers($thisuser); | ||
$xoopsMailer->setFromEmail($GLOBALS['xoopsConfig']['adminmail']); | ||
$xoopsMailer->setFromName($GLOBALS['xoopsConfig']['sitename']); | ||
$xoopsMailer->setSubject(sprintf(_US_YOURACCOUNT, $GLOBALS['xoopsConfig']['sitename'])); | ||
include $GLOBALS['xoops']->path('header.php'); | ||
if (!$xoopsMailer->send()) { | ||
printf(_US_ACTVMAILNG, $thisuser->getVar('uname')); | ||
} else { | ||
printf(_US_ACTVMAILOK, $thisuser->getVar('uname')); | ||
} | ||
include __DIR__ . '/footer.php'; | ||
} else { | ||
redirect_header(XOOPS_URL . '/user.php', 5, _US_ACTLOGIN, false); | ||
} | ||
} else { | ||
redirect_header(XOOPS_URL . '/index.php', 5, 'Activation failed!'); | ||
} | ||
} | ||
} | ||
// Not implemented yet: re-send activiation code | ||
} elseif (!empty($_REQUEST['email']) && $xoopsConfigUser['activation_type'] != 0) { | ||
$myts = MyTextSanitizer::getInstance(); | ||
/* @var XoopsMemberHandler $member_handler */ | ||
$member_handler = xoops_getHandler('member'); | ||
$getuser = $member_handler->getUsers(new Criteria('email', $myts->addSlashes(trim($_REQUEST['email'])))); | ||
if (count($getuser) == 0) { | ||
redirect_header(XOOPS_URL, 2, _US_SORRYNOTFOUND); | ||
} | ||
if ($getuser[0]->isActive()) { | ||
redirect_header(XOOPS_URL, 2, sprintf(_US_USERALREADYACTIVE, $getuser[0]->getVar('email'))); | ||
} | ||
$xoopsMailer = xoops_getMailer(); | ||
$xoopsMailer->useMail(); | ||
$xoopsMailer->setTemplate('register.tpl'); | ||
$xoopsMailer->assign('SITENAME', $GLOBALS['xoopsConfig']['sitename']); | ||
$xoopsMailer->assign('ADMINMAIL', $GLOBALS['xoopsConfig']['adminmail']); | ||
$xoopsMailer->assign('SITEURL', XOOPS_URL . '/'); | ||
$xoopsMailer->setToUsers($getuser[0]); | ||
$xoopsMailer->setFromEmail($GLOBALS['xoopsConfig']['adminmail']); | ||
$xoopsMailer->setFromName($GLOBALS['xoopsConfig']['sitename']); | ||
$xoopsMailer->setSubject(sprintf(_US_USERKEYFOR, $getuser[0]->getVar('uname'))); | ||
if (!$xoopsMailer->send()) { | ||
echo _US_YOURREGMAILNG; | ||
} else { | ||
echo _US_YOURREGISTERED; | ||
} | ||
} else { | ||
include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); | ||
$form = new XoopsThemeForm('', 'form', 'activate.php'); | ||
$form->addElement(new XoopsFormText(_US_EMAIL, 'email', 25, 255)); | ||
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); | ||
$form->display(); | ||
} | ||
|
||
$xoBreadcrumbs[] = array('title' => _MD_YOGURT_REGISTER); | ||
include __DIR__ . '/footer.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?php | ||
/* | ||
* You may not change or alter any portion of this comment or credits | ||
* of supporting developers from this source code or any supporting source code | ||
* which is considered copyrighted (c) material of the original comment or credit authors. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
*/ | ||
|
||
/** | ||
* @copyright {@link http://xoops.org/ XOOPS Project} | ||
* @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} | ||
* @package | ||
* @since | ||
* @author XOOPS Development Team | ||
*/ | ||
|
||
include_once __DIR__ . '/admin_header.php'; | ||
xoops_cp_header(); | ||
$indexAdmin = new ModuleAdmin(); | ||
|
||
$indexAdmin->addItemButton(_ADD . ' ' . _AM_YOGURT_CATEGORY, 'profile_fieldscategory.php?op=new', 'add', ''); | ||
|
||
echo $indexAdmin->addNavigation(basename(__FILE__)); | ||
echo $indexAdmin->renderButton('right', ''); | ||
|
||
$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : (isset($_REQUEST['id']) ? 'edit' : 'list'); | ||
|
||
/* @var YogurtCategoryHandler $handler */ | ||
$handler = xoops_getModuleHandler('category'); | ||
switch ($op) { | ||
default: | ||
case 'list': | ||
$criteria = new CriteriaCompo(); | ||
$criteria->setSort('cat_weight'); | ||
$criteria->setOrder('ASC'); | ||
$GLOBALS['xoopsTpl']->assign('categories', $handler->getObjects($criteria, true, false)); | ||
$template_main = 'admin/yogurt_admin_profilefieldscategory.tpl'; | ||
break; | ||
|
||
case 'new': | ||
include_once dirname(__DIR__) . '/include/forms.php'; | ||
$obj = $handler->create(); | ||
$form = $obj->getForm(); | ||
$form->display(); | ||
break; | ||
|
||
case 'edit': | ||
include_once dirname(__DIR__) . '/include/forms.php'; | ||
$obj = $handler->get($_REQUEST['id']); | ||
$form = $obj->getForm(); | ||
$form->display(); | ||
break; | ||
|
||
case 'save': | ||
if (!$GLOBALS['xoopsSecurity']->check()) { | ||
redirect_header('profile_fieldscategory.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); | ||
} | ||
if (isset($_REQUEST['id'])) { | ||
$obj = $handler->get($_REQUEST['id']); | ||
} else { | ||
$obj = $handler->create(); | ||
} | ||
$obj->setVar('cat_title', $_REQUEST['cat_title']); | ||
$obj->setVar('cat_description', $_REQUEST['cat_description']); | ||
$obj->setVar('cat_weight', $_REQUEST['cat_weight']); | ||
if ($handler->insert($obj)) { | ||
redirect_header('profile_fieldscategory.php', 3, sprintf(_AM_YOGURT_SAVEDSUCCESS, _AM_YOGURT_CATEGORY)); | ||
} | ||
include_once dirname(__DIR__) . '/include/forms.php'; | ||
echo $obj->getHtmlErrors(); | ||
/* @var XoopsThemeForm $form */ | ||
$form = $obj->getForm(); | ||
$form->display(); | ||
break; | ||
|
||
case 'delete': | ||
$obj = $handler->get($_REQUEST['id']); | ||
if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) { | ||
if (!$GLOBALS['xoopsSecurity']->check()) { | ||
redirect_header('profile_fieldscategory.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); | ||
} | ||
if ($handler->delete($obj)) { | ||
redirect_header('profile_fieldscategory.php', 3, sprintf(_AM_YOGURT_DELETEDSUCCESS, _AM_YOGURT_CATEGORY)); | ||
} else { | ||
echo $obj->getHtmlErrors(); | ||
} | ||
} else { | ||
xoops_confirm(array( | ||
'ok' => 1, | ||
'id' => $_REQUEST['id'], | ||
'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_YOGURT_RUSUREDEL, $obj->getVar('cat_title'))); | ||
} | ||
break; | ||
} | ||
if (isset($template_main)) { | ||
$GLOBALS['xoopsTpl']->display("db:{$template_main}"); | ||
} | ||
include_once __DIR__ . '/admin_footer.php'; |
Oops, something went wrong.