From: <tr...@us...> - 2011-11-23 22:06:54
|
Revision: 8336 http://xoops.svn.sourceforge.net/xoops/?rev=8336&view=rev Author: trabis Date: 2011-11-23 22:06:45 +0000 (Wed, 23 Nov 2011) Log Message: ----------- Some refactoring on Profile module Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/object.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/category.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/deactivate.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/field.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/header.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/menu.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/permissions.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/step.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/user.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/visibility.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/category.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/field.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/form/category.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/profile.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/regstep.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/visibility.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/include/forms.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/language/english/admin.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/xoops_version.php Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/form/field.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/form/regstep.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/categorylist.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/fieldlist.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/index.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/steplist.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/admin/visibility.html Removed Paths: ------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/profile_admin_categorylist.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/profile_admin_fieldlist.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/profile_admin_steplist.html XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/templates/profile_admin_visibility.html Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/object.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/object.php 2011-11-23 18:46:54 UTC (rev 8335) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/object.php 2011-11-23 22:06:45 UTC (rev 8336) @@ -49,7 +49,7 @@ * * @var array */ - protected $vars = array(); + public $vars = array(); /** * variables cleaned for store in DB Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/category.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/category.php 2011-11-23 18:46:54 UTC (rev 8335) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/category.php 2011-11-23 22:06:45 UTC (rev 8336) @@ -1,103 +1,96 @@ <?php -// $Id$ -// ------------------------------------------------------------------------ // -// XOOPS - PHP Content Management System // -// Copyright (c) 2000 XOOPS.org // -// <http://www.xoops.org/> // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// 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. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // -// Author: XOOPS Foundation // -// URL: http://www.xoops.org/ // -// Project: The XOOPS Project // -// ------------------------------------------------------------------------- // -include 'header.php'; -xoops_cp_header(); +/* + 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. +*/ + +/** + * Extended User Profile + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package profile + * @since 2.3.0 + * @author Taiwen Jiang <ph...@us...> + * @version $Id$ + */ + +include dirname(__FILE__) . '/header.php'; + $xoops = Xoops::getInstance(); +$xoops->header(); + $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : (isset($_REQUEST['id']) ? "edit" : 'list'); +/* @var $handler ProfileCategoryHandler */ +/* @var $obj ProfileCategory */ $handler = $xoops->getModuleHandler('category'); -switch($op ) { -default: -case "list": - $criteria = new CriteriaCompo(); - $criteria->setSort('cat_weight'); - $criteria->setOrder('ASC'); - $xoops->tpl->assign('categories', $handler->getObjects($criteria, true, false) ); - $template_main = "profile_admin_categorylist.html"; - break; +switch ($op) { + default: + case "list": + $criteria = new CriteriaCompo(); + $criteria->setSort('cat_weight'); + $criteria->setOrder('ASC'); + $xoops->tpl->assign('categories', $handler->getObjects($criteria, true, false)); + $template_main = "categorylist.html"; + break; -case "new": - include_once '../include/forms.php'; - $obj = $handler->create(); - $form = $obj->getForm(); - $form->display(); - break; - -case "edit": - include_once '../include/forms.php'; - $obj = $handler->get($_REQUEST['id']); - $form = $obj->getForm(); - $form->display(); - break; - -case "save": - if ( !$GLOBALS['xoopsSecurity']->check() ) { - $xoops->redirect('category.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() )); - } - if ( isset($_REQUEST['id']) ) { - $obj = $handler->get($_REQUEST['id']); - } else { + case "new": $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) ) { - $xoops->redirect('category.php', 3, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_CATEGORY) ); - } - include_once '../include/forms.php'; - echo $obj->getHtmlErrors(); - $form = $obj->getForm(); - $form->display(); - break; + $form = $obj->getForm(); + $form->display(); + break; -case "delete": - $obj = $handler->get($_REQUEST['id']); - if ( isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1 ) { - if ( !$GLOBALS['xoopsSecurity']->check() ) { - $xoops->redirect('category.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() )); + case "edit": + $handler->get($_REQUEST['id']); + $form = $obj->getForm(); + $form->display(); + break; + + case "save": + if (!$xoops->security->check()) { + $xoops->redirect('category.php', 3, implode(',', $xoops->security->getErrors())); } - if ( $handler->delete($obj) ) { - $xoops->redirect('category.php', 3, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_CATEGORY) ); + if (isset($_REQUEST['id'])) { + $obj = $handler->get($_REQUEST['id']); } else { - echo $obj->getHtmlErrors(); + $obj = $handler->create(); } - } else { - $xoops->confirm(array('ok' => 1, 'id' => $_REQUEST['id'], 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_PROFILE_AM_RUSUREDEL, $obj->getVar('cat_title') )); - } - break; + $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)) { + $xoops->redirect('category.php', 3, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_CATEGORY)); + } + echo $obj->getHtmlErrors(); + $form = $obj->getForm(); + $form->display(); + break; + + case "delete": + $obj = $handler->get($_REQUEST['id']); + if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) { + if (!$xoops->security->check()) { + $xoops->redirect('category.php', 3, implode(',', $xoops->security->getErrors())); + } + if ($handler->delete($obj)) { + $xoops->redirect('category.php', 3, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_CATEGORY)); + } else { + echo $obj->getHtmlErrors(); + } + } else { + $xoops->confirm(array( + 'ok' => 1, 'id' => $_REQUEST['id'], 'op' => 'delete' + ), $_SERVER['REQUEST_URI'], sprintf(_PROFILE_AM_RUSUREDEL, $obj->getVar('cat_title'))); + } + break; } -if ( isset($template_main) ) { - $xoops->tpl->display("module:profile|{$template_main}"); +if (isset($template_main)) { + $xoops->tpl->display("admin:profile|{$template_main}"); } -xoops_cp_footer(); -?> \ No newline at end of file +$xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/deactivate.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/deactivate.php 2011-11-23 18:46:54 UTC (rev 8335) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/deactivate.php 2011-11-23 22:06:45 UTC (rev 8336) @@ -1,32 +1,53 @@ <?php -include 'header.php'; -xoops_cp_header(); +/* + 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. -if ( !isset($_REQUEST['uid']) ) { + 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. +*/ + +/** + * Extended User Profile + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package profile + * @since 2.3.0 + * @author Taiwen Jiang <ph...@us...> + * @version $Id$ + */ + +include dirname(__FILE__) . '/header.php'; +$xoops = Xoops::getInstance(); +$xoops->header(); + +if (!isset($_REQUEST['uid'])) { $xoops->redirect("index.php", 2, _PROFILE_AM_NOSELECTION); } $member_handler = $xoops->getHandlerMember(); $user = $member_handler->getUser($_REQUEST['uid']); -if ( !$user || $user->isNew() ) { +if (!$user || $user->isNew()) { $xoops->redirect("index.php", 2, _PROFILE_AM_USERDONEXIT); } -if ( in_array(XOOPS_GROUP_ADMIN, $user->getGroups() ) ) { +if (in_array(XOOPS_GROUP_ADMIN, $user->getGroups())) { $xoops->redirect("index.php", 2, _PROFILE_AM_CANNOTDEACTIVATEWEBMASTERS); } $user->setVar('level', $_REQUEST['level']); -if ( $member_handler->insertUser($user) ) { - if ( $_REQUEST['level'] == 1 ) { +if ($member_handler->insertUser($user)) { + if ($_REQUEST['level'] == 1) { $message = _PROFILE_AM_USER_ACTIVATED; } else { $message = _PROFILE_AM_USER_DEACTIVATED; } } else { - if ( $_REQUEST['level'] == 1 ) { + if ($_REQUEST['level'] == 1) { $message = _PROFILE_AM_USER_NOT_ACTIVATED; } else { $message = _PROFILE_AM_USER_NOT_DEACTIVATED; } } -$xoops->redirect("../userinfo.php?uid=" . $user->getVar('uid'), 3, $message); -?> \ No newline at end of file +$xoops->redirect($xoops->url('modules/profile/userinfo.php?uid=' . $user->getVar('uid')), 3, $message); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/field.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/field.php 2011-11-23 18:46:54 UTC (rev 8335) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/field.php 2011-11-23 22:06:45 UTC (rev 8336) @@ -1,14 +1,17 @@ <?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. +*/ + /** * 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 The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package profile @@ -17,287 +20,282 @@ * @author Taiwen Jiang <ph...@us...> * @version $Id$ */ -include 'header.php'; -xoops_cp_header(); + +include dirname(__FILE__) . '/header.php'; + $xoops = Xoops::getInstance(); +$xoops->header(); $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : (isset($_REQUEST['id']) ? "edit" : 'list'); +/* @var $profilefield_handler ProfileFieldHandler */ $profilefield_handler = $xoops->getModuleHandler('field'); -switch($op ) { -default: -case "list": - $fields = $profilefield_handler->getObjects(null, true, false); - $modules = $xoops->getHandlerModule()->getObjectsArray(null, true); +/* @var $obj ProfileField */ - $cat_handler = $xoops->getModuleHandler('category'); - $criteria = new CriteriaCompo(); - $criteria->setSort('cat_weight'); - $cats = $cat_handler->getObjects($criteria, true); - unset($criteria); +switch ($op) { + default: + case "list": + $fields = $profilefield_handler->getObjects(null, true, false); + $modules = $xoops->getHandlerModule()->getObjectsArray(null, true); - $categories[0] = _PROFILE_AM_DEFAULT; - if ( count($cats) > 0 ) { - foreach (array_keys($cats) as $i ) { - $categories[$cats[$i]->getVar('cat_id')] = $cats[$i]->getVar('cat_title'); + $cat_handler = $xoops->getModuleHandler('category'); + $criteria = new CriteriaCompo(); + $criteria->setSort('cat_weight'); + $cats = $cat_handler->getObjects($criteria, true); + unset($criteria); + + $categories[0] = _PROFILE_AM_DEFAULT; + if (count($cats) > 0) { + foreach (array_keys($cats) as $i) { + $categories[$cats[$i]->getVar('cat_id')] = $cats[$i]->getVar('cat_title'); + } } - } - $xoops->tpl->assign('categories', $categories); - unset($categories); - $valuetypes = array(XOBJ_DTYPE_ARRAY => _PROFILE_AM_ARRAY, - XOBJ_DTYPE_EMAIL => _PROFILE_AM_EMAIL, - XOBJ_DTYPE_INT => _PROFILE_AM_INT, - XOBJ_DTYPE_TXTAREA => _PROFILE_AM_TXTAREA, - XOBJ_DTYPE_TXTBOX => _PROFILE_AM_TXTBOX, - XOBJ_DTYPE_URL => _PROFILE_AM_URL, - XOBJ_DTYPE_OTHER => _PROFILE_AM_OTHER, - XOBJ_DTYPE_MTIME => _PROFILE_AM_DATE); + $xoops->tpl->assign('categories', $categories); + unset($categories); + $valuetypes = array( + XOBJ_DTYPE_ARRAY => _PROFILE_AM_ARRAY, XOBJ_DTYPE_EMAIL => _PROFILE_AM_EMAIL, + XOBJ_DTYPE_INT => _PROFILE_AM_INT, XOBJ_DTYPE_TXTAREA => _PROFILE_AM_TXTAREA, + XOBJ_DTYPE_TXTBOX => _PROFILE_AM_TXTBOX, XOBJ_DTYPE_URL => _PROFILE_AM_URL, + XOBJ_DTYPE_OTHER => _PROFILE_AM_OTHER, XOBJ_DTYPE_MTIME => _PROFILE_AM_DATE + ); - $fieldtypes = array('checkbox' => _PROFILE_AM_CHECKBOX, - 'group' => _PROFILE_AM_GROUP, - 'group_multi' => _PROFILE_AM_GROUPMULTI, - 'language' => _PROFILE_AM_LANGUAGE, - 'radio' => _PROFILE_AM_RADIO, - 'select' => _PROFILE_AM_SELECT, - 'select_multi' => _PROFILE_AM_SELECTMULTI, - 'textarea' => _PROFILE_AM_TEXTAREA, - 'dhtml' => _PROFILE_AM_DHTMLTEXTAREA, - 'textbox' => _PROFILE_AM_TEXTBOX, - 'timezone' => _PROFILE_AM_TIMEZONE, - 'yesno' => _PROFILE_AM_YESNO, - 'date' => _PROFILE_AM_DATE, - 'datetime' => _PROFILE_AM_DATETIME, - 'longdate' => _PROFILE_AM_LONGDATE, - 'theme' => _PROFILE_AM_THEME, - 'autotext' => _PROFILE_AM_AUTOTEXT, - 'rank' => _PROFILE_AM_RANK); + $fieldtypes = array( + 'checkbox' => _PROFILE_AM_CHECKBOX, 'group' => _PROFILE_AM_GROUP, 'group_multi' => _PROFILE_AM_GROUPMULTI, + 'language' => _PROFILE_AM_LANGUAGE, 'radio' => _PROFILE_AM_RADIO, 'select' => _PROFILE_AM_SELECT, + 'select_multi' => _PROFILE_AM_SELECTMULTI, 'textarea' => _PROFILE_AM_TEXTAREA, + 'dhtml' => _PROFILE_AM_DHTMLTEXTAREA, 'textbox' => _PROFILE_AM_TEXTBOX, 'timezone' => _PROFILE_AM_TIMEZONE, + 'yesno' => _PROFILE_AM_YESNO, 'date' => _PROFILE_AM_DATE, 'datetime' => _PROFILE_AM_DATETIME, + 'longdate' => _PROFILE_AM_LONGDATE, 'theme' => _PROFILE_AM_THEME, 'autotext' => _PROFILE_AM_AUTOTEXT, + 'rank' => _PROFILE_AM_RANK + ); + $categories = array(); + foreach (array_keys($fields) as $i) { + $fields[$i]['canEdit'] = $fields[$i]['field_config'] || $fields[$i]['field_show'] || $fields[$i]['field_edit']; + $fields[$i]['canDelete'] = $fields[$i]['field_config']; + $fields[$i]['fieldtype'] = $fieldtypes[$fields[$i]['field_type']]; + $fields[$i]['valuetype'] = $valuetypes[$fields[$i]['field_valuetype']]; + $categories[$fields[$i]['cat_id']][] = $fields[$i]; + $weights[$fields[$i]['cat_id']][] = $fields[$i]['field_weight']; + } + //sort fields order in categories + foreach (array_keys($categories) as $i) { + array_multisort($weights[$i], SORT_ASC, array_keys($categories[$i]), SORT_ASC, $categories[$i]); + } + ksort($categories); + $xoops->tpl->assign('fieldcategories', $categories); + $xoops->tpl->assign('token', $xoops->security->getTokenHTML()); + $template_main = "fieldlist.html"; + break; - foreach (array_keys($fields) as $i ) { - $fields[$i]['canEdit'] = $fields[$i]['field_config'] || $fields[$i]['field_show'] || $fields[$i]['field_edit']; - $fields[$i]['canDelete'] = $fields[$i]['field_config']; - $fields[$i]['fieldtype'] = $fieldtypes[$fields[$i]['field_type']]; - $fields[$i]['valuetype'] = $valuetypes[$fields[$i]['field_valuetype']]; - $categories[$fields[$i]['cat_id']][] = $fields[$i]; - $weights[$fields[$i]['cat_id']][] = $fields[$i]['field_weight']; - } - //sort fields order in categories - foreach (array_keys($categories) as $i ) { - array_multisort($weights[$i], SORT_ASC, array_keys($categories[$i]), SORT_ASC, $categories[$i]); - } - ksort($categories); - $xoops->tpl->assign('fieldcategories', $categories); - $xoops->tpl->assign('token', $GLOBALS['xoopsSecurity']->getTokenHTML() ); - $template_main = "profile_admin_fieldlist.html"; - break; + case "new": + $obj = $profilefield_handler->create(); + $form = $obj->getForm(); + $form->display(); + break; -case "new": - include_once('../include/forms.php'); - $obj = $profilefield_handler->create(); - $form = profile_getFieldForm($obj); - $form->display(); - break; + case "edit": + $obj = $profilefield_handler->get($_REQUEST['id']); + if (!$obj->getVar('field_config') && !$obj->getVar('field_show') && !$obj->getVar('field_edit')) { //If no configs exist + $xoops->redirect('field.php', 2, _PROFILE_AM_FIELDNOTCONFIGURABLE); + } + $form = $obj->getForm(); + $form->display(); + break; -case "edit": - $obj = $profilefield_handler->get($_REQUEST['id']); - if ( !$obj->getVar('field_config') && !$obj->getVar('field_show') && !$obj->getVar('field_edit') ) { //If no configs exist - $xoops->redirect('field.php', 2, _PROFILE_AM_FIELDNOTCONFIGURABLE); - } - include_once('../include/forms.php'); - $form = profile_getFieldForm($obj); - $form->display(); - break; - -case "reorder": - if ( !$GLOBALS['xoopsSecurity']->check() ) { - $xoops->redirect('field.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() )); - } - if ( isset($_POST['field_ids']) && count($_POST['field_ids']) > 0 ) { - $oldweight = $_POST['oldweight']; - $oldcat = $_POST['oldcat']; - $category = $_POST['category']; - $weight = $_POST['weight']; - $ids = array(); - foreach ($_POST['field_ids'] as $field_id ) { - if ( $oldweight[$field_id] != $weight[$field_id] || $oldcat[$field_id] != $category[$field_id] ) { - //if field has changed - $ids[] = intval($field_id); - } + case "reorder": + if (!$xoops->security->check()) { + $xoops->redirect('field.php', 3, implode(',', $xoops->security->getErrors())); } - if ( count($ids) > 0 ) { - $errors = array(); - //if there are changed fields, fetch the fieldcategory objects - $field_handler = $xoops->getModuleHandler('field'); - $fields = $field_handler->getObjects(new Criteria('field_id', "(" . implode(',', $ids) . ")", "IN"), true); - foreach ($ids as $i ) { - $fields[$i]->setVar('field_weight', intval($weight[$i]) ); - $fields[$i]->setVar('cat_id', intval($category[$i]) ); - if ( !$field_handler->insert($fields[$i]) ) { - $errors = array_merge($errors, $fields[$i]->getErrors() ); + if (isset($_POST['field_ids']) && count($_POST['field_ids']) > 0) { + $oldweight = $_POST['oldweight']; + $oldcat = $_POST['oldcat']; + $category = $_POST['category']; + $weight = $_POST['weight']; + $ids = array(); + foreach ($_POST['field_ids'] as $field_id) { + if ($oldweight[$field_id] != $weight[$field_id] || $oldcat[$field_id] != $category[$field_id]) { + //if field has changed + $ids[] = intval($field_id); } } - if ( count($errors) == 0 ) { - //no errors - $xoops->redirect('field.php', 2, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_FIELDS) ); - } else { - $xoops->redirect('field.php', 3, implode('<br />', $errors) ); + if (count($ids) > 0) { + $errors = array(); + //if there are changed fields, fetch the fieldcategory objects + $field_handler = $xoops->getModuleHandler('field'); + $fields = $field_handler->getObjects(new Criteria('field_id', "(" . implode(',', $ids) . ")", "IN"), true); + foreach ($ids as $i) { + $fields[$i]->setVar('field_weight', intval($weight[$i])); + $fields[$i]->setVar('cat_id', intval($category[$i])); + if (!$field_handler->insert($fields[$i])) { + $errors = array_merge($errors, $fields[$i]->getErrors()); + } + } + if (count($errors) == 0) { + //no errors + $xoops->redirect('field.php', 2, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_FIELDS)); + } else { + $xoops->redirect('field.php', 3, implode('<br />', $errors)); + } } } - } - break; + break; -case "save": - if ( !$GLOBALS['xoopsSecurity']->check() ) { - $xoops->redirect('field.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() )); - } - $redirect_to_edit = false; - if ( isset($_REQUEST['id']) ) { - $obj = $profilefield_handler->get($_REQUEST['id']); - if ( !$obj->getVar('field_config') && !$obj->getVar('field_show') && !$obj->getVar('field_edit') ) { //If no configs exist - $xoops->redirect('admin.php', 2, _PROFILE_AM_FIELDNOTCONFIGURABLE); + case "save": + if (!$xoops->security->check()) { + $xoops->redirect('field.php', 3, implode(',', $xoops->security->getErrors())); } - } else { - $obj = $profilefield_handler->create(); - $obj->setVar('field_name', $_REQUEST['field_name']); - $obj->setVar('field_moduleid', $xoops->module->getVar('mid') ); - $obj->setVar('field_show', 1); - $obj->setVar('field_edit', 1); - $obj->setVar('field_config', 1); - $redirect_to_edit = true; - } - $obj->setVar('field_title', $_REQUEST['field_title']); - $obj->setVar('field_description', $_REQUEST['field_description']); - if ( $obj->getVar('field_config') ) { - $obj->setVar('field_type', $_REQUEST['field_type']); - if ( isset($_REQUEST['field_valuetype']) ) { - $obj->setVar('field_valuetype', $_REQUEST['field_valuetype']); - } - $options = $obj->getVar('field_options'); - - if ( isset($_REQUEST['removeOptions']) && is_array($_REQUEST['removeOptions']) ) { - foreach ($_REQUEST['removeOptions'] as $index ) { - unset($options[$index]); + $redirect_to_edit = false; + if (isset($_REQUEST['id'])) { + $obj = $profilefield_handler->get($_REQUEST['id']); + if (!$obj->getVar('field_config') && !$obj->getVar('field_show') && !$obj->getVar('field_edit')) { //If no configs exist + $xoops->redirect('admin.php', 2, _PROFILE_AM_FIELDNOTCONFIGURABLE); } + } else { + $obj = $profilefield_handler->create(); + $obj->setVar('field_name', $_REQUEST['field_name']); + $obj->setVar('field_moduleid', $xoops->module->getVar('mid')); + $obj->setVar('field_show', 1); + $obj->setVar('field_edit', 1); + $obj->setVar('field_config', 1); $redirect_to_edit = true; } + $obj->setVar('field_title', $_REQUEST['field_title']); + $obj->setVar('field_description', $_REQUEST['field_description']); + if ($obj->getVar('field_config')) { + $obj->setVar('field_type', $_REQUEST['field_type']); + if (isset($_REQUEST['field_valuetype'])) { + $obj->setVar('field_valuetype', $_REQUEST['field_valuetype']); + } + $options = $obj->getVar('field_options'); - if ( !empty($_REQUEST['addOption']) ) { - foreach ($_REQUEST['addOption'] as $option ) { - if ( empty($option['value']) ) continue; - $options[$option['key']] = $option['value']; + if (isset($_REQUEST['removeOptions']) && is_array($_REQUEST['removeOptions'])) { + foreach ($_REQUEST['removeOptions'] as $index) { + unset($options[$index]); + } $redirect_to_edit = true; } + + if (!empty($_REQUEST['addOption'])) { + foreach ($_REQUEST['addOption'] as $option) { + if (empty($option['value'])) { + continue; + } + $options[$option['key']] = $option['value']; + $redirect_to_edit = true; + } + } + $obj->setVar('field_options', $options); } - $obj->setVar('field_options', $options); - } - if ( $obj->getVar('field_edit') ) { - $required = isset($_REQUEST['field_required']) ? $_REQUEST['field_required'] : 0; - $obj->setVar('field_required', $required); //0 = no, 1 = yes - if ( isset($_REQUEST['field_maxlength']) ) { - $obj->setVar('field_maxlength', $_REQUEST['field_maxlength']); - } - if ( isset($_REQUEST['field_default']) ) { - $field_default = $obj->getValueForSave($_REQUEST['field_default']); - //Check for multiple selections - if ( is_array($field_default) ) { - $obj->setVar('field_default', serialize($field_default) ); - } else { - $obj->setVar('field_default', $field_default); + if ($obj->getVar('field_edit')) { + $required = isset($_REQUEST['field_required']) ? $_REQUEST['field_required'] : 0; + $obj->setVar('field_required', $required); //0 = no, 1 = yes + if (isset($_REQUEST['field_maxlength'])) { + $obj->setVar('field_maxlength', $_REQUEST['field_maxlength']); } + if (isset($_REQUEST['field_default'])) { + $field_default = $obj->getValueForSave($_REQUEST['field_default']); + //Check for multiple selections + if (is_array($field_default)) { + $obj->setVar('field_default', serialize($field_default)); + } else { + $obj->setVar('field_default', $field_default); + } + } } - } - if ( $obj->getVar('field_show') ) { - $obj->setVar('field_weight', $_REQUEST['field_weight']); - $obj->setVar('cat_id', $_REQUEST['field_category']); - } - if ( /*$obj->getVar('field_edit') && */isset($_REQUEST['step_id']) ) { - $obj->setVar('step_id', $_REQUEST['step_id']); - } - if ( $profilefield_handler->insert($obj) ) { - $groupperm_handler = $xoops->getHandlerGroupperm(); - - $perm_arr = array(); - if ( $obj->getVar('field_show') ) { - $perm_arr[] = 'profile_show'; - $perm_arr[] = 'profile_visible'; + if ($obj->getVar('field_show')) { + $obj->setVar('field_weight', $_REQUEST['field_weight']); + $obj->setVar('cat_id', $_REQUEST['field_category']); } - if ( $obj->getVar('field_edit') ) { - $perm_arr[] = 'profile_edit'; + if ( /*$obj->getVar('field_edit') && */ + isset($_REQUEST['step_id']) + ) { + $obj->setVar('step_id', $_REQUEST['step_id']); } - if ( $obj->getVar('field_edit') || $obj->getVar('field_show') ) { - $perm_arr[] = 'profile_search'; - } - if ( count($perm_arr) > 0 ) { - foreach ($perm_arr as $perm ) { - $criteria = new CriteriaCompo(new Criteria('gperm_name', $perm) ); - $criteria->add(new Criteria('gperm_itemid', intval($obj->getVar('field_id') )) ); - $criteria->add(new Criteria('gperm_modid', intval($xoops->module->getVar('mid') )) ); - if ( isset($_REQUEST[$perm]) && is_array($_REQUEST[$perm]) ) { - $perms = $groupperm_handler->getObjects($criteria); - if ( count($perms) > 0 ) { - foreach (array_keys($perms) as $i ) { - $groups[$perms[$i]->getVar('gperm_groupid')] = $perms[$i]; + if ($profilefield_handler->insert($obj)) { + $groupperm_handler = $xoops->getHandlerGroupperm(); + + $perm_arr = array(); + if ($obj->getVar('field_show')) { + $perm_arr[] = 'profile_show'; + $perm_arr[] = 'profile_visible'; + } + if ($obj->getVar('field_edit')) { + $perm_arr[] = 'profile_edit'; + } + if ($obj->getVar('field_edit') || $obj->getVar('field_show')) { + $perm_arr[] = 'profile_search'; + } + if (count($perm_arr) > 0) { + foreach ($perm_arr as $perm) { + $criteria = new CriteriaCompo(new Criteria('gperm_name', $perm)); + $criteria->add(new Criteria('gperm_itemid', intval($obj->getVar('field_id')))); + $criteria->add(new Criteria('gperm_modid', intval($xoops->module->getVar('mid')))); + if (isset($_REQUEST[$perm]) && is_array($_REQUEST[$perm])) { + $perms = $groupperm_handler->getObjects($criteria); + if (count($perms) > 0) { + foreach (array_keys($perms) as $i) { + $groups[$perms[$i]->getVar('gperm_groupid')] = $perms[$i]; + } + } else { + $groups = array(); } - } else { - $groups = array(); - } - foreach ($_REQUEST[$perm] as $groupid ) { - $groupid = intval($groupid); - if ( !isset($groups[$groupid]) ) { - $perm_obj = $groupperm_handler->create(); - $perm_obj->setVar('gperm_name', $perm); - $perm_obj->setVar('gperm_itemid', intval($obj->getVar('field_id') )); - $perm_obj->setVar('gperm_modid', $xoops->module->getVar('mid') ); - $perm_obj->setVar('gperm_groupid', $groupid); - $groupperm_handler->insert($perm_obj); - unset($perm_obj); + foreach ($_REQUEST[$perm] as $groupid) { + $groupid = intval($groupid); + if (!isset($groups[$groupid])) { + $perm_obj = $groupperm_handler->create(); + $perm_obj->setVar('gperm_name', $perm); + $perm_obj->setVar('gperm_itemid', intval($obj->getVar('field_id'))); + $perm_obj->setVar('gperm_modid', $xoops->module->getVar('mid')); + $perm_obj->setVar('gperm_groupid', $groupid); + $groupperm_handler->insert($perm_obj); + unset($perm_obj); + } } - } - $removed_groups = array_diff(array_keys($groups), $_REQUEST[$perm]); - if ( count($removed_groups) > 0 ) { - $criteria->add(new Criteria('gperm_groupid', "(".implode(',', $removed_groups).")", "IN") ); + $removed_groups = array_diff(array_keys($groups), $_REQUEST[$perm]); + if (count($removed_groups) > 0) { + $criteria->add(new Criteria('gperm_groupid', "(" . implode(',', $removed_groups) . ")", "IN")); + $groupperm_handler->deleteAll($criteria); + } + unset($groups); + } else { $groupperm_handler->deleteAll($criteria); } - unset($groups); - - } else { - $groupperm_handler->deleteAll($criteria); + unset($criteria); } - unset($criteria); } + $url = $redirect_to_edit ? 'field.php?op=edit&id=' . $obj->getVar('field_id') : 'field.php'; + $xoops->redirect($url, 3, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_FIELD)); } - $url = $redirect_to_edit ? 'field.php?op=edit&id=' . $obj->getVar('field_id') : 'field.php'; - $xoops->redirect($url, 3, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_FIELD) ); - } - include_once('../include/forms.php'); - echo $obj->getHtmlErrors(); - $form = profile_getFieldForm($obj); - $form->display(); - break; + echo $obj->getHtmlErrors(); + $form = $obj->getForm(); + $form->display(); + break; -case "delete": - $obj = $profilefield_handler->get($_REQUEST['id']); - if ( !$obj->getVar('field_config') ) { - $xoops->redirect('index.php', 2, _PROFILE_AM_FIELDNOTCONFIGURABLE); - } - if ( isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1 ) { - if ( !$GLOBALS['xoopsSecurity']->check() ) { - $xoops->redirect('field.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() )); + case "delete": + $obj = $profilefield_handler->get($_REQUEST['id']); + if (!$obj->getVar('field_config')) { + $xoops->redirect('index.php', 2, _PROFILE_AM_FIELDNOTCONFIGURABLE); } - if ( $profilefield_handler->delete($obj) ) { - $xoops->redirect('field.php', 3, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_FIELD) ); + if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) { + if (!$xoops->security->check()) { + $xoops->redirect('field.php', 3, implode(',', $xoops->security->getErrors())); + } + if ($profilefield_handler->delete($obj)) { + $xoops->redirect('field.php', 3, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_FIELD)); + } else { + echo $obj->getHtmlErrors(); + } } else { - echo $obj->getHtmlErrors(); + $xoops->confirm(array( + 'ok' => 1, 'id' => $_REQUEST['id'], 'op' => 'delete' + ), $_SERVER['REQUEST_URI'], sprintf(_PROFILE_AM_RUSUREDEL, $obj->getVar('field_title'))); } - } else { - $xoops->confirm(array('ok' => 1, 'id' => $_REQUEST['id'], 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_PROFILE_AM_RUSUREDEL, $obj->getVar('field_title') )); - } - break; + break; } -if ( isset($template_main) ) { - $xoops->tpl->display("module:profile|{$template_main}"); +if (isset($template_main)) { + $xoops->tpl->display("admin:profile|{$template_main}"); } -xoops_cp_footer(); -?> \ No newline at end of file +$xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/header.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/header.php 2011-11-23 18:46:54 UTC (rev 8335) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/header.php 2011-11-23 22:06:45 UTC (rev 8336) @@ -1,14 +1,17 @@ <?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. +*/ + /** * 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 The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package profile @@ -17,10 +20,7 @@ * @version $Id$ */ -require_once "../../../include/cp_header.php"; +require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; $xoops = Xoops::getInstance(); -$xoops->loadLanguage('user'); -if (!$xoops->tpl instanceof XoopsTpl) { - $xoops->tpl = new XoopsTpl(); -} \ No newline at end of file +$xoops->loadLanguage('user'); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/menu.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/menu.php 2011-11-23 18:46:54 UTC (rev 8335) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/menu.php 2011-11-23 22:06:45 UTC (rev 8336) @@ -1,14 +1,17 @@ <?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. +*/ + /** * 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 The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package profile @@ -17,6 +20,7 @@ * @author Taiwen Jiang <ph...@us...> * @version $Id$ */ + $adminmenu[1]['title'] = _PROFILE_MI_USERS; $adminmenu[1]['link'] = "admin/user.php"; $adminmenu[2]['title'] = _PROFILE_MI_CATEGORIES; @@ -26,6 +30,4 @@ $adminmenu[4]['title'] = _PROFILE_MI_STEPS; $adminmenu[4]['link'] = "admin/step.php"; $adminmenu[5]['title'] = _PROFILE_MI_PERMISSIONS; -$adminmenu[5]['link'] = "admin/permissions.php"; - -?> \ No newline at end of file +$adminmenu[5]['link'] = "admin/permissions.php"; \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/permissions.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/permissions.php 2011-11-23 18:46:54 UTC (rev 8335) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/permissions.php 2011-11-23 22:06:45 UTC (rev 8336) @@ -1,14 +1,17 @@ <?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. +*/ + /** * 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 The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package profile @@ -17,9 +20,10 @@ * @author Taiwen Jiang <ph...@us...> * @version $Id$ */ -include 'header.php'; -xoops_cp_header(); +include dirname(__FILE__) . '/header.php'; + $xoops = Xoops::getInstance(); +$xoops->header(); $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : "edit"; @@ -76,6 +80,7 @@ } } else { + /* @var $profile_handler ProfileProfileHandler */ $profile_handler = $xoops->getModuleHandler('profile'); $fields = $profile_handler->loadFields(); @@ -102,5 +107,4 @@ } } $form->display(); -xoops_cp_footer(); -?> \ No newline at end of file +$xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/step.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/step.php 2011-11-23 18:46:54 UTC (rev 8335) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/step.php 2011-11-23 22:06:45 UTC (rev 8336) @@ -1,14 +1,17 @@ <?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. +*/ + /** * 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 The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package profile @@ -17,34 +20,37 @@ * @author Taiwen Jiang <ph...@us...> * @version $Id$ */ -include 'header.php'; -xoops_cp_header(); +include dirname(__FILE__) . '/header.php'; + +$xoops = Xoops::getInstance(); +$xoops->header(); + $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : (isset($_REQUEST['id']) ? "edit" : 'list'); +/* @var $handler ProfileRegstepHandler */ $handler = $xoops->getModuleHandler('regstep'); -switch ($op ) { +/* @var $obj ProfileRegstep */ +switch ($op) { case "list": - $xoops->tpl->assign('steps', $handler->getObjects(null, true, false) ); - $template_main = "profile_admin_steplist.html"; + $xoops->tpl->assign('steps', $handler->getObjects(null, true, false)); + $template_main = "steplist.html"; break; case "new": $obj = $handler->create(); - include_once "../include/forms.php"; - $form = profile_getStepForm($obj);; + $form = $obj->getForm(); $form->display(); break; case "edit": $obj = $handler->get($_REQUEST['id']); - include_once "../include/forms.php"; - $form = profile_getStepForm($obj);; + $form = $obj->getForm(); $form->display(); break; case "save": - if ( isset($_REQUEST['id']) ) { + if (isset($_REQUEST['id'])) { $obj = $handler->get($_REQUEST['id']); } else { $obj = $handler->create(); @@ -53,8 +59,8 @@ $obj->setVar('step_order', $_REQUEST['step_order']); $obj->setVar('step_desc', $_REQUEST['step_desc']); $obj->setVar('step_save', $_REQUEST['step_save']); - if ( $handler->insert($obj) ) { - $xoops->redirect('step.php', 3, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_STEP) ); + if ($handler->insert($obj)) { + $xoops->redirect('step.php', 3, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_STEP)); } echo $obj->getHtmlErrors(); $form = $obj->getForm(); @@ -63,21 +69,22 @@ case "delete": $obj = $handler->get($_REQUEST['id']); - if ( isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1 ) { - if ( $handler->delete($obj) ) { - $xoops->redirect('step.php', 3, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_STEP) ); + if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) { + if ($handler->delete($obj)) { + $xoops->redirect('step.php', 3, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_STEP)); } else { echo $obj->getHtmlErrors(); } } else { - $xoops->confirm(array('ok' => 1, 'id' => $_REQUEST['id'], 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_PROFILE_AM_RUSUREDEL, $obj->getVar('step_name') )); + $xoops->confirm(array( + 'ok' => 1, 'id' => $_REQUEST['id'], 'op' => 'delete' + ), $_SERVER['REQUEST_URI'], sprintf(_PROFILE_AM_RUSUREDEL, $obj->getVar('step_name'))); } break; } -if ( !empty($template_main) ) { - $xoops->tpl->display("module:profile|{$template_main}"); +if (!empty($template_main)) { + $xoops->tpl->display("admin:profile|{$template_main}"); } -xoops_cp_footer(); -?> \ No newline at end of file +$xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/user.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/user.php 2011-11-23 18:46:54 UTC (rev 8335) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/user.php 2011-11-23 22:06:45 UTC (rev 8336) @@ -1,14 +1,17 @@ <?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. +*/ + /** * 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 The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package profile @@ -17,15 +20,17 @@ * @author Taiwen Jiang <ph...@us...> * @version $Id$ */ -include 'header.php'; +include dirname(__FILE__) . '/header.php'; + $xoops = Xoops::getInstance(); -xoops_cp_header(); +$xoops->header(); $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : 'list'; if ($op == "editordelete") { $op = isset($_REQUEST['delete']) ? "delete" : "edit"; } + $handler = $xoops->getHandlerMember(); switch ($op) { @@ -42,7 +47,7 @@ case "new": $xoops->loadLanguage("main", $xoops->module->getVar('dirname', 'n')); - include_once '../include/forms.php'; + include_once dirname(dirname(__FILE__)) . '/include/forms.php'; $obj = $handler->createUser(); $obj->setGroups(array(XOOPS_GROUP_USERS)); $form = profile_getUserForm($obj); @@ -56,19 +61,20 @@ // If not webmaster trying to edit a webmaster - disallow $xoops->redirect("user.php", 3, _US_NOEDITRIGHT); } - include_once '../include/forms.php'; + include_once dirname(dirname(__FILE__)) . '/include/forms.php'; $form = profile_getUserForm($obj); $form->display(); break; case "save": $xoops->loadLanguage("main", $xoops->module->getVar('dirname', 'n')); - if (!$GLOBALS['xoopsSecurity']->check()) { - $xoops->redirect('user.php', 3, _US_NOEDITRIGHT . "<br />" . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); + if (!$xoops->security->check()) { + $xoops->redirect('user.php', 3, _US_NOEDITRIGHT . "<br />" . implode('<br />', $xoops->security->getErrors())); exit; } // Dynamic fields + /* @var $profile_handler ProfileProfileHandler */ $profile_handler = $xoops->getModuleHandler('profile'); // Get fields $fields = $profile_handler->loadFields(); @@ -175,7 +181,7 @@ } } $user->setGroups($new_groups); - include_once '../include/forms.php'; + include_once dirname(dirname(__FILE__)) . '/include/forms.php'; echo $user->getHtmlErrors(); $form = profile_getUserForm($user, $profile); $form->display(); @@ -192,8 +198,8 @@ } if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) { - if (!$GLOBALS['xoopsSecurity']->check()) { - $xoops->redirect('user.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()), false); + if (!$xoops->security->check()) { + $xoops->redirect('user.php', 3, implode(',', $xoops->security->getErrors()), false); } $profile_handler = $xoops->getModuleHandler('profile'); $profile = $profile_handler->get($obj->getVar('uid')); @@ -215,5 +221,4 @@ break; } -xoops_cp_footer(); -?> \ No newline at end of file +$xoops->footer(); \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/visibility.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/visibility.php 2011-11-23 18:46:54 UTC (rev 8335) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/visibility.php 2011-11-23 22:06:45 UTC (rev 8336) @@ -1,14 +1,17 @@ <?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. +*/ + /** * 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 The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package profile @@ -17,15 +20,16 @@ * @author Taiwen Jiang <ph...@us...> * @version $Id$ */ -include 'header.php'; +include dirname(__FILE__) . '/header.php'; + $xoops = Xoops::getInstance(); //there is no way to override current tabs when using system menu //this dirty hack will have to do it $_SERVER['REQUEST_URI'] = "admin/permissions.php"; -xoops_cp_header(); +$xoops->header(); $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : "visibility"; @@ -33,22 +37,20 @@ $field_handler = $xoops->getModuleHandler('field'); $fields = $field_handler->getList(); -if ( isset($_REQUEST['submit']) ) { +if (isset($_REQUEST['submit'])) { $visibility = $visibility_handler->create(); $visibility->setVar('field_id', $_REQUEST['field_id']); $visibility->setVar('user_group', $_REQUEST['ug']); $visibility->setVar('profile_group', $_REQUEST['pg']); $visibility_handler->insert($visibility, true); - $xoops->redirect("visibility.php", 2, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_PROF_VISIBLE) ); - exit(); + $xoops->redirect("visibility.php", 2, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_PROF_VISIBLE)); } -if ( $op == "del" ) { - $criteria = new CriteriaCompo(new Criteria('field_id', intval($_REQUEST['field_id']) )); - $criteria->add(new Criteria('user_group', intval($_REQUEST['ug']) )); - $criteria->add(new Criteria('profile_group', intval($_REQUEST['pg']) )); +if ($op == "del") { + $criteria = new CriteriaCompo(new Criteria('field_id', intval($_REQUEST['field_id']))); + $criteria->add(new Criteria('user_group', intval($_REQUEST['ug']))); + $criteria->add(new Criteria('profile_group', intval($_REQUEST['pg']))); $visibility_handler->deleteAll($criteria, true); - $xoops->redirect("visibility.php", 2, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_PROF_VISIBLE) ); - exit(); + $xoops->redirect("visibility.php", 2, sprintf(_PROFILE_AM_DELETEDSUCCESS, _PROFILE_AM_PROF_VISIBLE)); } $opform = new XoopsSimpleForm('', 'opform', 'permissions.php', "get"); @@ -92,10 +94,9 @@ $sel_pg->addOptionArray($groups); $add_form->addElement($sel_pg); -$add_form->addElement(new XoopsFormButton('', 'submit', _... [truncated message content] |