|
From: <be...@us...> - 2014-05-25 10:52:47
|
Revision: 12549
http://sourceforge.net/p/xoops/svn/12549
Author: beckmi
Date: 2014-05-25 10:52:42 +0000 (Sun, 25 May 2014)
Log Message:
-----------
- added routine to delete .html templates (slider84)
- added extra Captcha check for the first registration step (Roby73/mamba)
- added routine to delete /images and other folder when updating (cesag/mamba)
Modified Paths:
--------------
XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/admin/menu.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/docs/changelog.txt
XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/include/forms.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/include/update.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/language/english/modinfo.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/userinfo.php
XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/xoops_version.php
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/admin/menu.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/admin/menu.php 2014-05-25 10:51:18 UTC (rev 12548)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/admin/menu.php 2014-05-25 10:52:42 UTC (rev 12549)
@@ -42,27 +42,27 @@
$adminmenu[$i]['title'] = _PROFILE_MI_HOME;
$adminmenu[$i]['link'] = "admin/index.php";
$adminmenu[$i]['icon'] = $pathIcon32.'/home.png' ;
-$i++;
+++$i;
$adminmenu[$i]['title'] = _PROFILE_MI_USERS;
$adminmenu[$i]['link'] = "admin/user.php";
$adminmenu[$i]['icon'] = $pathIcon32.'/users.png' ;
-$i++;
+++$i;
$adminmenu[$i]['title'] = _PROFILE_MI_CATEGORIES;
$adminmenu[$i]['link'] = "admin/category.php";
$adminmenu[$i]['icon'] = $pathIcon32.'/category.png' ;
-$i++;
+++$i;
$adminmenu[$i]['title'] = _PROFILE_MI_FIELDS;
$adminmenu[$i]['link'] = "admin/field.php";
$adminmenu[$i]['icon'] = $pathIcon32.'/index.png' ;
-$i++;
+++$i;
$adminmenu[$i]['title'] = _PROFILE_MI_STEPS;
$adminmenu[$i]['link'] = "admin/step.php";
$adminmenu[$i]['icon'] = $pathIcon32.'/stats.png' ;
-$i++;
+++$i;
$adminmenu[$i]['title'] = _PROFILE_MI_PERMISSIONS;
$adminmenu[$i]['link'] = "admin/permissions.php";
$adminmenu[$i]['icon'] = $pathIcon32.'/permissions.png' ;
-$i++;
+++$i;
$adminmenu[$i]['title'] = _PROFILE_MI_ABOUT;
$adminmenu[$i]['link'] = 'admin/about.php';
$adminmenu[$i]['icon'] = $pathIcon32.'/about.png';
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/docs/changelog.txt
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/docs/changelog.txt 2014-05-25 10:51:18 UTC (rev 12548)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/docs/changelog.txt 2014-05-25 10:52:42 UTC (rev 12549)
@@ -4,6 +4,8 @@
- renamed .html Smarty templates to .tpl (mamba)
- fixed missing .tpl (cesag/slider84)
- added routine to delete .html templates (slider84)
+- added extra Captcha check for the first registration step (Roby73/mamba)
+- added routine to delete /images and other folder when updating (cesag/mamba)
1.64 Final
--------------------------------------
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/include/forms.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/include/forms.php 2014-05-25 10:51:18 UTC (rev 12548)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/include/forms.php 2014-05-25 10:52:42 UTC (rev 12549)
@@ -23,8 +23,8 @@
/**
* Get {@link XoopsThemeForm} for adding/editing fields
*
- * @param object $field {@link ProfileField} object to get edit form for
- * @param mixed $action URL to submit to - or false for $_SERVER['REQUEST_URI']
+ * @param object $field {@link ProfileField} object to get edit form for
+ * @param mixed $action URL to submit to - or false for $_SERVER['REQUEST_URI']
*
* @return object
*/
@@ -47,7 +47,7 @@
$fieldcat_id = 0;
}
$category_handler =& xoops_getmodulehandler('category');
- $cat_select = new XoopsFormSelect(_PROFILE_AM_CATEGORY, 'field_category', $fieldcat_id);
+ $cat_select = new XoopsFormSelect(_PROFILE_AM_CATEGORY, 'field_category', $fieldcat_id);
$cat_select->addOption(0, _PROFILE_AM_DEFAULT);
$cat_select->addOptionArray($category_handler->getList());
$form->addElement($cat_select);
@@ -62,21 +62,22 @@
//autotext and theme left out of this one as fields of that type should never be changed (valid assumption, I think)
$fieldtypes = array(
- 'checkbox' => _PROFILE_AM_CHECKBOX,
- 'date' => _PROFILE_AM_DATE,
- 'datetime' => _PROFILE_AM_DATETIME,
- 'longdate' => _PROFILE_AM_LONGDATE,
- 'group' => _PROFILE_AM_GROUP,
- 'group_multi' => _PROFILE_AM_GROUPMULTI,
- 'language' => _PROFILE_AM_LANGUAGE,
- 'radio' => _PROFILE_AM_RADIO,
- 'select' => _PROFILE_AM_SELECT,
+ 'checkbox' => _PROFILE_AM_CHECKBOX,
+ 'date' => _PROFILE_AM_DATE,
+ 'datetime' => _PROFILE_AM_DATETIME,
+ 'longdate' => _PROFILE_AM_LONGDATE,
+ '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);
+ 'textarea' => _PROFILE_AM_TEXTAREA,
+ 'dhtml' => _PROFILE_AM_DHTMLTEXTAREA,
+ 'textbox' => _PROFILE_AM_TEXTBOX,
+ 'timezone' => _PROFILE_AM_TIMEZONE,
+ 'yesno' => _PROFILE_AM_YESNO
+ );
$element_select = new XoopsFormSelect(_PROFILE_AM_TYPE, 'field_type', $field->getVar('field_type', 'e'));
$element_select->addOptionArray($fieldtypes);
@@ -86,20 +87,21 @@
switch ($field->getVar('field_type')) {
case "textbox":
$valuetypes = array(
- XOBJ_DTYPE_ARRAY => _PROFILE_AM_ARRAY,
- XOBJ_DTYPE_EMAIL => _PROFILE_AM_EMAIL,
- XOBJ_DTYPE_INT => _PROFILE_AM_INT,
- XOBJ_DTYPE_FLOAT => _PROFILE_AM_FLOAT,
- XOBJ_DTYPE_DECIMAL => _PROFILE_AM_DECIMAL,
- 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_UNICODE_ARRAY => _PROFILE_AM_UNICODE_ARRAY,
- XOBJ_DTYPE_UNICODE_TXTBOX => _PROFILE_AM_UNICODE_TXTBOX,
- XOBJ_DTYPE_UNICODE_TXTAREA => _PROFILE_AM_UNICODE_TXTAREA,
- XOBJ_DTYPE_UNICODE_EMAIL => _PROFILE_AM_UNICODE_EMAIL,
- XOBJ_DTYPE_UNICODE_URL => _PROFILE_AM_UNICODE_URL);
+ XOBJ_DTYPE_ARRAY => _PROFILE_AM_ARRAY,
+ XOBJ_DTYPE_EMAIL => _PROFILE_AM_EMAIL,
+ XOBJ_DTYPE_INT => _PROFILE_AM_INT,
+ XOBJ_DTYPE_FLOAT => _PROFILE_AM_FLOAT,
+ XOBJ_DTYPE_DECIMAL => _PROFILE_AM_DECIMAL,
+ 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_UNICODE_ARRAY => _PROFILE_AM_UNICODE_ARRAY,
+ XOBJ_DTYPE_UNICODE_TXTBOX => _PROFILE_AM_UNICODE_TXTBOX,
+ XOBJ_DTYPE_UNICODE_TXTAREA => _PROFILE_AM_UNICODE_TXTAREA,
+ XOBJ_DTYPE_UNICODE_EMAIL => _PROFILE_AM_UNICODE_EMAIL,
+ XOBJ_DTYPE_UNICODE_URL => _PROFILE_AM_UNICODE_URL
+ );
$type_select = new XoopsFormSelect(_PROFILE_AM_VALUETYPE, 'field_valuetype', $field->getVar('field_valuetype', 'e'));
$type_select->addOptionArray($valuetypes);
@@ -109,20 +111,21 @@
case "select":
case "radio":
$valuetypes = array(
- XOBJ_DTYPE_ARRAY => _PROFILE_AM_ARRAY,
- XOBJ_DTYPE_EMAIL => _PROFILE_AM_EMAIL,
- XOBJ_DTYPE_INT => _PROFILE_AM_INT,
- XOBJ_DTYPE_FLOAT => _PROFILE_AM_FLOAT,
- XOBJ_DTYPE_DECIMAL => _PROFILE_AM_DECIMAL,
- 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_UNICODE_ARRAY => _PROFILE_AM_UNICODE_ARRAY,
- XOBJ_DTYPE_UNICODE_TXTBOX => _PROFILE_AM_UNICODE_TXTBOX,
- XOBJ_DTYPE_UNICODE_TXTAREA => _PROFILE_AM_UNICODE_TXTAREA,
- XOBJ_DTYPE_UNICODE_EMAIL => _PROFILE_AM_UNICODE_EMAIL,
- XOBJ_DTYPE_UNICODE_URL => _PROFILE_AM_UNICODE_URL);
+ XOBJ_DTYPE_ARRAY => _PROFILE_AM_ARRAY,
+ XOBJ_DTYPE_EMAIL => _PROFILE_AM_EMAIL,
+ XOBJ_DTYPE_INT => _PROFILE_AM_INT,
+ XOBJ_DTYPE_FLOAT => _PROFILE_AM_FLOAT,
+ XOBJ_DTYPE_DECIMAL => _PROFILE_AM_DECIMAL,
+ 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_UNICODE_ARRAY => _PROFILE_AM_UNICODE_ARRAY,
+ XOBJ_DTYPE_UNICODE_TXTBOX => _PROFILE_AM_UNICODE_TXTBOX,
+ XOBJ_DTYPE_UNICODE_TXTAREA => _PROFILE_AM_UNICODE_TXTAREA,
+ XOBJ_DTYPE_UNICODE_EMAIL => _PROFILE_AM_UNICODE_EMAIL,
+ XOBJ_DTYPE_UNICODE_URL => _PROFILE_AM_UNICODE_URL
+ );
$type_select = new XoopsFormSelect(_PROFILE_AM_VALUETYPE, 'field_valuetype', $field->getVar('field_valuetype', 'e'));
$type_select->addOptionArray($valuetypes);
@@ -135,7 +138,7 @@
if ($field->getVar('field_type') == "select" || $field->getVar('field_type') == "select_multi" || $field->getVar('field_type') == "radio" || $field->getVar('field_type') == "checkbox") {
$options = $field->getVar('field_options');
if (count($options) > 0) {
- $remove_options = new XoopsFormCheckBox(_PROFILE_AM_REMOVEOPTIONS, 'removeOptions');
+ $remove_options = new XoopsFormCheckBox(_PROFILE_AM_REMOVEOPTIONS, 'removeOptions');
$remove_options->columns = 3;
asort($options);
foreach (array_keys($options) as $key) {
@@ -146,12 +149,12 @@
}
$option_text = "<table cellspacing='1'><tr><td class='width20'>" . _PROFILE_AM_KEY . "</td><td>" . _PROFILE_AM_VALUE . "</td></tr>";
- for ($i = 0; $i < 3; $i++) {
+ for ($i = 0; $i < 3; ++$i) {
$option_text .= "<tr><td><input type='text' name='addOption[{$i}][key]' id='addOption[{$i}][key]' size='15' /></td><td><input type='text' name='addOption[{$i}][value]' id='addOption[{$i}][value]' size='35' /></td></tr>";
$option_text .= "<tr height='3px'><td colspan='2'> </td></tr>";
}
$option_text .= "</table>";
- $form->addElement(new XoopsFormLabel(_PROFILE_AM_ADDOPTION, $option_text) );
+ $form->addElement(new XoopsFormLabel(_PROFILE_AM_ADDOPTION, $option_text));
}
}
@@ -167,8 +170,8 @@
case "checkbox":
case "select_multi":
$def_value = $field->getVar('field_default', 'e') != null ? unserialize($field->getVar('field_default', 'n')) : null;
- $element = new XoopsFormSelect(_PROFILE_AM_DEFAULT, 'field_default', $def_value, 8, true);
- $options = $field->getVar('field_options');
+ $element = new XoopsFormSelect(_PROFILE_AM_DEFAULT, 'field_default', $def_value, 8, true);
+ $options = $field->getVar('field_options');
asort($options);
// If options do not include an empty element, then add a blank option to prevent any default selection
if (!in_array('', array_keys($options))) {
@@ -181,8 +184,8 @@
case "select":
case "radio":
$def_value = $field->getVar('field_default', 'e') != null ? $field->getVar('field_default') : null;
- $element = new XoopsFormSelect(_PROFILE_AM_DEFAULT, 'field_default', $def_value);
- $options = $field->getVar('field_options');
+ $element = new XoopsFormSelect(_PROFILE_AM_DEFAULT, 'field_default', $def_value);
+ $options = $field->getVar('field_options');
asort($options);
// If options do not include an empty element, then add a blank option to prevent any default selection
if (!in_array('', array_keys($options))) {
@@ -235,7 +238,7 @@
}
$groupperm_handler =& xoops_gethandler('groupperm');
- $searchable_types = array(
+ $searchable_types = array(
'textbox',
'select',
'radio',
@@ -243,10 +246,11 @@
'date',
'datetime',
'timezone',
- 'language');
+ 'language'
+ );
if (in_array($field->getVar('field_type'), $searchable_types)) {
$search_groups = $groupperm_handler->getGroupIds('profile_search', $field->getVar('field_id'), $GLOBALS['xoopsModule']->getVar('mid'));
- $form->addElement(new XoopsFormSelectGroup(_PROFILE_AM_PROF_SEARCH, 'profile_search', true, $search_groups, 5, true) );
+ $form->addElement(new XoopsFormSelectGroup(_PROFILE_AM_PROF_SEARCH, 'profile_search', true, $search_groups, 5, true));
}
if ($field->getVar('field_edit') || $field->isNew()) {
if (!$field->isNew()) {
@@ -263,7 +267,7 @@
$regstep_select->addOptionArray($regstep_handler->getList());
$form->addElement($regstep_select);
}
- $form->addElement(new XoopsFormHidden('op', 'save') );
+ $form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
return $form;
@@ -275,30 +279,30 @@
* @param object $user
* @param $profile
* @param object $user {@link XoopsUser} to register
- * @param int $step Which step we are at
+ * @param int $step Which step we are at
*
* @internal param \profileRegstep $next_step
- *
* @return object
*/
function profile_getRegisterForm(&$user, $profile, $step = null)
{
global $opkey; // should be set in register.php
if (empty($opkey)) {
- $opkey='profile_opname';
+ $opkey = 'profile_opname';
}
- $next_opname = 'op' . mt_rand(10000, 99999);
+ $next_opname = 'op' . mt_rand(10000, 99999);
$_SESSION[$opkey] = $next_opname;
+
include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
if (empty($GLOBALS['xoopsConfigUser'])) {
- $config_handler =& xoops_gethandler('config');
+ $config_handler =& xoops_gethandler('config');
$GLOBALS['xoopsConfigUser'] = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
}
- $action = $_SERVER['REQUEST_URI'];
- $step_no = $step['step_no'];
+ $action = $_SERVER['REQUEST_URI'];
+ $step_no = $step['step_no'];
$use_token = $step['step_no'] > 0 ? true : false;
- $reg_form = new XoopsThemeForm($step['step_name'], 'regform', $action, 'post', $use_token);
+ $reg_form = new XoopsThemeForm($step['step_name'], 'regform', $action, 'post', $use_token);
if ($step['step_desc']) {
$reg_form->addElement(new XoopsFormLabel('', $step['step_desc']));
@@ -308,21 +312,21 @@
//$uname_size = $GLOBALS['xoopsConfigUser']['maxuname'] < 35 ? $GLOBALS['xoopsConfigUser']['maxuname'] : 35;
$elements[0][] = array('element' => new XoopsFormText(_US_NICKNAME, 'uname', 35, $GLOBALS['xoopsConfigUser']['maxuname'], $user->getVar('uname', 'e')), 'required' => true);
- $weights[0][] = 0;
+ $weights[0][] = 0;
- $elements[0][] = array('element' => new XoopsFormText(_US_EMAIL, 'email', 35, 255, $user->getVar('email', 'e') ), 'required' => true);
- $weights[0][] = 0;
+ $elements[0][] = array('element' => new XoopsFormText(_US_EMAIL, 'email', 35, 255, $user->getVar('email', 'e')), 'required' => true);
+ $weights[0][] = 0;
$elements[0][] = array('element' => new XoopsFormPassword(_US_PASSWORD, 'pass', 35, 32, ''), 'required' => true);
- $weights[0][] = 0;
+ $weights[0][] = 0;
$elements[0][] = array('element' => new XoopsFormPassword(_US_VERIFYPASS, 'vpass', 35, 32, ''), 'required' => true);
- $weights[0][] = 0;
+ $weights[0][] = 0;
}
// Dynamic fields
- $profile_handler =& xoops_getmodulehandler('profile');
- $fields = $profile_handler->loadFields();
+ $profile_handler =& xoops_getmodulehandler('profile');
+ $fields = $profile_handler->loadFields();
$_SESSION['profile_required'] = array();
foreach (array_keys($fields) as $i) {
if ($fields[$i]->getVar('step_id') == $step['step_id']) {
@@ -332,16 +336,16 @@
$_SESSION['profile_required'][$fields[$i]->getVar('field_name')] = $fields[$i]->getVar('field_title');
}
- $key = $fields[$i]->getVar('cat_id');
+ $key = $fields[$i]->getVar('cat_id');
$elements[$key][] = $fieldinfo;
- $weights[$key][] = $fields[$i]->getVar('field_weight');
+ $weights[$key][] = $fields[$i]->getVar('field_weight');
}
}
ksort($elements);
// Get categories
$cat_handler =& xoops_getmodulehandler('category');
- $categories = $cat_handler->getObjects(null, true, false);
+ $categories = $cat_handler->getObjects(null, true, false);
foreach (array_keys($elements) as $k) {
array_multisort($weights[$k], SORT_ASC, array_keys($elements[$k]), SORT_ASC, $elements[$k]);
@@ -364,26 +368,28 @@
$disc_tray->addElement($agree_chk);
$reg_form->addElement($disc_tray);
}
+ global $xoopsModuleConfig;
+ $useCaptchaAfterStep2 = $xoopsModuleConfig['profileCaptchaAfterStep1'] + 1;
- if ($step_no == 1) {
+ if ($step_no <= $useCaptchaAfterStep2) {
$reg_form->addElement(new XoopsFormCaptcha(), true);
}
$reg_form->addElement(new XoopsFormHidden($next_opname, 'register'));
$reg_form->addElement(new XoopsFormHidden('uid', $user->getVar('uid')));
- $reg_form->addElement(new XoopsFormHidden('step', $step_no) );
+ $reg_form->addElement(new XoopsFormHidden('step', $step_no));
$reg_form->addElement(new XoopsFormButton('', 'submitButton', _SUBMIT, 'submit'));
-
return $reg_form;
}
+
/**
* Get {@link XoopsThemeForm} for editing a user
*
* @param object $user {@link XoopsUser} to edit
- *
* @param null $profile
* @param bool $action
+ *
* @return object
*/
function profile_getUserForm(&$user, $profile = null, $action = false)
@@ -392,7 +398,7 @@
$action = $_SERVER['REQUEST_URI'];
}
if (empty($GLOBALS['xoopsConfigUser'])) {
- $config_handler =& xoops_gethandler('config');
+ $config_handler =& xoops_gethandler('config');
$GLOBALS['xoopsConfigUser'] = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
}
@@ -406,57 +412,60 @@
// Dynamic fields
if (!$profile) {
$profile_handler =& xoops_getmodulehandler('profile', 'profile');
- $profile = $profile_handler->get($user->getVar('uid') );
+ $profile = $profile_handler->get($user->getVar('uid'));
}
// Get fields
$fields = $profile_handler->loadFields();
// Get ids of fields that can be edited
- $gperm_handler =& xoops_gethandler('groupperm');
- $editable_fields = $gperm_handler->getItemIds('profile_edit', $GLOBALS['xoopsUser']->getGroups(), $GLOBALS['xoopsModule']->getVar('mid') );
+ $gperm_handler =& xoops_gethandler('groupperm');
+ $editable_fields = $gperm_handler->getItemIds('profile_edit', $GLOBALS['xoopsUser']->getGroups(), $GLOBALS['xoopsModule']->getVar('mid'));
if ($user->isNew() || $GLOBALS['xoopsUser']->isAdmin()) {
- $elements[0][] = array('element' => new XoopsFormText(_US_NICKNAME, 'uname', 25, $GLOBALS['xoopsUser']->isAdmin() ? 60 : $GLOBALS['xoopsConfigUser']['maxuname'], $user->getVar('uname', 'e') ), 'required' => 1);
- $email_text = new XoopsFormText('', 'email', 30, 60, $user->getVar('email'));
+ $elements[0][] = array(
+ 'element' => new XoopsFormText(_US_NICKNAME, 'uname', 25, $GLOBALS['xoopsUser']->isAdmin() ? 60 : $GLOBALS['xoopsConfigUser']['maxuname'], $user->getVar('uname', 'e')),
+ 'required' => 1
+ );
+ $email_text = new XoopsFormText('', 'email', 30, 60, $user->getVar('email'));
} else {
- $elements[0][] = array('element' => new XoopsFormLabel(_US_NICKNAME, $user->getVar('uname') ), 'required' => 0);
- $email_text = new XoopsFormLabel('', $user->getVar('email') );
+ $elements[0][] = array('element' => new XoopsFormLabel(_US_NICKNAME, $user->getVar('uname')), 'required' => 0);
+ $email_text = new XoopsFormLabel('', $user->getVar('email'));
}
$email_tray = new XoopsFormElementTray(_US_EMAIL, '<br />');
- $email_tray->addElement($email_text, ($user->isNew() || $GLOBALS['xoopsUser']->isAdmin() ) ? 1 : 0);
- $weights[0][] = 0;
+ $email_tray->addElement($email_text, ($user->isNew() || $GLOBALS['xoopsUser']->isAdmin()) ? 1 : 0);
+ $weights[0][] = 0;
$elements[0][] = array('element' => $email_tray, 'required' => 0);
- $weights[0][] = 0;
+ $weights[0][] = 0;
if ($GLOBALS['xoopsUser']->isAdmin() && $user->getVar('uid') != $GLOBALS['xoopsUser']->getVar('uid')) {
//If the user is an admin and is editing someone else
- $pwd_text = new XoopsFormPassword('', 'password', 10, 32);
+ $pwd_text = new XoopsFormPassword('', 'password', 10, 32);
$pwd_text2 = new XoopsFormPassword('', 'vpass', 10, 32);
- $pwd_tray = new XoopsFormElementTray(_US_PASSWORD . '<br />' . _US_TYPEPASSTWICE);
+ $pwd_tray = new XoopsFormElementTray(_US_PASSWORD . '<br />' . _US_TYPEPASSTWICE);
$pwd_tray->addElement($pwd_text);
$pwd_tray->addElement($pwd_text2);
$elements[0][] = array('element' => $pwd_tray, 'required' => 0); //cannot set an element tray required
- $weights[0][] = 0;
+ $weights[0][] = 0;
$level_radio = new XoopsFormRadio(_PROFILE_MA_USERLEVEL, 'level', $user->getVar('level'));
$level_radio->addOption(1, _PROFILE_MA_ACTIVE);
$level_radio->addOption(0, _PROFILE_MA_INACTIVE);
//$level_radio->addOption(-1, _PROFILE_MA_DISABLED);
$elements[0][] = array('element' => $level_radio, 'required' => 0);
- $weights[0][] = 0;
+ $weights[0][] = 0;
}
- $elements[0][] = array('element' => new XoopsFormHidden('uid', $user->getVar('uid') ), 'required' => 0);
- $weights[0][] = 0;
+ $elements[0][] = array('element' => new XoopsFormHidden('uid', $user->getVar('uid')), 'required' => 0);
+ $weights[0][] = 0;
$elements[0][] = array('element' => new XoopsFormHidden('op', 'save'), 'required' => 0);
- $weights[0][] = 0;
+ $weights[0][] = 0;
- $cat_handler = xoops_getmodulehandler('category');
- $categories = array();
+ $cat_handler = xoops_getmodulehandler('category');
+ $categories = array();
$all_categories = $cat_handler->getObjects(null, true, false);
- $count_fields = count($fields);
+ $count_fields = count($fields);
- foreach (array_keys($fields) as $i ) {
- if ( in_array($fields[$i]->getVar('field_id'), $editable_fields) ) {
+ foreach (array_keys($fields) as $i) {
+ if (in_array($fields[$i]->getVar('field_id'), $editable_fields)) {
// Set default value for user fields if available
if ($user->isNew()) {
$default = $fields[$i]->getVar('field_default');
@@ -470,12 +479,12 @@
$profile->setVar($fields[$i]->getVar('field_name'), $default);
}
- $fieldinfo['element'] = $fields[$i]->getEditElement($user, $profile);
+ $fieldinfo['element'] = $fields[$i]->getEditElement($user, $profile);
$fieldinfo['required'] = $fields[$i]->getVar('field_required');
- $key = @$all_categories[$fields[$i]->getVar('cat_id')]['cat_weight'] * $count_fields + $fields[$i]->getVar('cat_id');
+ $key = @$all_categories[$fields[$i]->getVar('cat_id')]['cat_weight'] * $count_fields + $fields[$i]->getVar('cat_id');
$elements[$key][] = $fieldinfo;
- $weights[$key][] = $fields[$i]->getVar('field_weight');
+ $weights[$key][] = $fields[$i]->getVar('field_weight');
$categories[$key] = @$all_categories[$fields[$i]->getVar('cat_id')];
}
}
@@ -487,10 +496,10 @@
include_once $GLOBALS['xoops']->path('modules/system/constants.php');
if ($gperm_handler->checkRight('system_admin', XOOPS_SYSTEM_GROUP, $GLOBALS['xoopsUser']->getGroups(), 1)) {
//add group selection
- $group_select = new XoopsFormSelectGroup(_US_GROUPS, 'groups', false, $user->getGroups(), 5, true);
+ $group_select = new XoopsFormSelectGroup(_US_GROUPS, 'groups', false, $user->getGroups(), 5, true);
$elements[0][] = array('element' => $group_select, 'required' => 0);
//set as latest;
- $weights[0][] = $count_fields +1;
+ $weights[0][] = $count_fields + 1;
}
}
@@ -498,16 +507,15 @@
foreach (array_keys($elements) as $k) {
array_multisort($weights[$k], SORT_ASC, array_keys($elements[$k]), SORT_ASC, $elements[$k]);
$title = isset($categories[$k]) ? $categories[$k]['cat_title'] : _PROFILE_MA_DEFAULT;
- $desc = isset($categories[$k]) ? $categories[$k]['cat_description'] : "";
+ $desc = isset($categories[$k]) ? $categories[$k]['cat_description'] : "";
$form->addElement(new XoopsFormLabel("<h3>{$title}</h3>", $desc), false);
foreach (array_keys($elements[$k]) as $i) {
$form->addElement($elements[$k][$i]['element'], $elements[$k][$i]['required']);
}
}
- $form->addElement(new XoopsFormHidden('uid', $user->getVar('uid') ));
+ $form->addElement(new XoopsFormHidden('uid', $user->getVar('uid')));
$form->addElement(new XoopsFormButton('', 'submit', _US_SAVECHANGES, 'submit'));
-
return $form;
}
@@ -515,8 +523,8 @@
* Get {@link XoopsThemeForm} for editing a step
*
* @param object $step {@link ProfileRegstep} to edit
+ * @param bool $action
*
- * @param bool $action
* @return object
*/
function profile_getStepForm($step = null, $action = false)
@@ -525,7 +533,7 @@
$action = $_SERVER['REQUEST_URI'];
}
if (empty($GLOBALS['xoopsConfigUser'])) {
- $config_handler =& xoops_gethandler('config');
+ $config_handler =& xoops_gethandler('config');
$GLOBALS['xoopsConfigUser'] = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
}
include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
@@ -533,9 +541,9 @@
$form = new XoopsThemeForm(_PROFILE_AM_STEP, 'stepform', 'step.php', 'post', true);
if (!$step->isNew()) {
- $form->addElement(new XoopsFormHidden('id', $step->getVar('step_id') ));
+ $form->addElement(new XoopsFormHidden('id', $step->getVar('step_id')));
}
- $form->addElement(new XoopsFormHidden('op', 'save') );
+ $form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormText(_PROFILE_AM_STEPNAME, 'step_name', 25, 255, $step->getVar('step_name', 'e')));
$form->addElement(new XoopsFormText(_PROFILE_AM_STEPINTRO, 'step_desc', 25, 255, $step->getVar('step_desc', 'e')));
$form->addElement(new XoopsFormText(_PROFILE_AM_STEPORDER, 'step_order', 10, 10, $step->getVar('step_order', 'e')));
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/include/update.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/include/update.php 2014-05-25 10:51:18 UTC (rev 12548)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/include/update.php 2014-05-25 10:52:42 UTC (rev 12549)
@@ -17,13 +17,16 @@
* @version $Id$
*/
+$path = dirname(dirname(dirname(dirname(__FILE__))));
+require_once $path . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'cp_header.php';
+
function xoops_module_update_profile(&$module, $oldversion = null)
{
- if ( $oldversion < 162 ) {
+ if ($oldversion < 162) {
$GLOBALS['xoopsDB']->queryF("UPDATE `" . $GLOBALS['xoopsDB']->prefix("profile_field") . " SET field_valuetype=2 WHERE field_name=umode");
}
- if ( $oldversion < 100 ) {
+ if ($oldversion < 100) {
// Drop old category table
$sql = "DROP TABLE " . $GLOBALS['xoopsDB']->prefix("profile_category");
@@ -40,41 +43,36 @@
xoops_module_install_profile($module);
$goupperm_handler =& xoops_getHandler("groupperm");
- $field_handler =& xoops_getModuleHandler('field', $module->getVar('dirname', 'n') );
- $skip_fields = $field_handler->getUserVars();
+ $field_handler =& xoops_getModuleHandler('field', $module->getVar('dirname', 'n'));
+ $skip_fields = $field_handler->getUserVars();
$skip_fields[] = 'newemail';
$skip_fields[] = 'pm_link';
- $sql = "SELECT * FROM `" . $GLOBALS['xoopsDB']->prefix("user_profile_field") . "` WHERE `field_name` NOT IN ('" . implode("', '", $skip_fields) . "')";
- $result = $GLOBALS['xoopsDB']->query($sql);
- $fields = array();
- while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result) ) {
+ $sql = "SELECT * FROM `" . $GLOBALS['xoopsDB']->prefix("user_profile_field") . "` WHERE `field_name` NOT IN ('" . implode("', '", $skip_fields) . "')";
+ $result = $GLOBALS['xoopsDB']->query($sql);
+ $fields = array();
+ while ($myrow = $GLOBALS['xoopsDB']->fetchArray($result)) {
$fields[] = $myrow['field_name'];
- $object =& $field_handler->create();
+ $object =& $field_handler->create();
$object->setVars($myrow, true);
$object->setVar('cat_id', 1);
- if ( !empty($myrow['field_register']) ) {
+ if (!empty($myrow['field_register'])) {
$object->setVar('step_id', 2);
}
- if ( !empty($myrow['field_options']) ) {
- $object->setVar('field_options', unserialize($myrow['field_options']) );
+ if (!empty($myrow['field_options'])) {
+ $object->setVar('field_options', unserialize($myrow['field_options']));
}
$field_handler->insert($object, true);
$gperm_itemid = $object->getVar('field_id');
- $sql = "UPDATE " . $GLOBALS['xoopsDB']->prefix("group_permission") . " SET gperm_itemid = " . $gperm_itemid .
- " WHERE gperm_itemid = " . $myrow['fieldid'] .
- " AND gperm_modid = " . $module->getVar('mid') .
- " AND gperm_name IN ('profile_edit', 'profile_search')";
+ $sql = "UPDATE " . $GLOBALS['xoopsDB']->prefix("group_permission") . " SET gperm_itemid = " . $gperm_itemid . " WHERE gperm_itemid = " . $myrow['fieldid'] . " AND gperm_modid = "
+ . $module->getVar('mid') . " AND gperm_name IN ('profile_edit', 'profile_search')";
$GLOBALS['xoopsDB']->queryF($sql);
- $groups_visible = $goupperm_handler->getGroupIds("profile_visible", $myrow['fieldid'], $module->getVar('mid') );
- $groups_show = $goupperm_handler->getGroupIds("profile_show", $myrow['fieldid'], $module->getVar('mid') );
- foreach ($groups_visible as $ugid ) {
- foreach ($groups_show as $pgid ) {
- $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix("profile_visibility") .
- " (field_id, user_group, profile_group) " .
- " VALUES " .
- " ({$gperm_itemid}, {$ugid}, {$pgid})";
+ $groups_visible = $goupperm_handler->getGroupIds("profile_visible", $myrow['fieldid'], $module->getVar('mid'));
+ $groups_show = $goupperm_handler->getGroupIds("profile_show", $myrow['fieldid'], $module->getVar('mid'));
+ foreach ($groups_visible as $ugid) {
+ foreach ($groups_show as $pgid) {
+ $sql = "INSERT INTO " . $GLOBALS['xoopsDB']->prefix("profile_visibility") . " (field_id, user_group, profile_group) " . " VALUES " . " ({$gperm_itemid}, {$ugid}, {$pgid})";
$GLOBALS['xoopsDB']->queryF($sql);
}
}
@@ -84,8 +82,10 @@
}
// Copy data from profile table
- foreach ($fields as $field ) {
- $GLOBALS['xoopsDB']->queryF("UPDATE `" . $GLOBALS['xoopsDB']->prefix("profile_profile") . "` u, `" . $GLOBALS['xoopsDB']->prefix("user_profile") . "` p SET u.{$field} = p.{$field} WHERE u.profile_id=p.profileid");
+ foreach ($fields as $field) {
+ $GLOBALS['xoopsDB']->queryF(
+ "UPDATE `" . $GLOBALS['xoopsDB']->prefix("profile_profile") . "` u, `" . $GLOBALS['xoopsDB']->prefix("user_profile") . "` p SET u.{$field} = p.{$field} WHERE u.profile_id=p.profileid"
+ );
}
// Drop old profile table
@@ -97,8 +97,7 @@
$GLOBALS['xoopsDB']->queryF($sql);
// Remove not used items
- $sql = "DELETE FROM " . $GLOBALS['xoopsDB']->prefix("group_permission") .
- " WHERE `gperm_modid` = " . $module->getVar('mid') . " AND `gperm_name` IN ('profile_show', 'profile_visible')";
+ $sql = "DELETE FROM " . $GLOBALS['xoopsDB']->prefix("group_permission") . " WHERE `gperm_modid` = " . $module->getVar('mid') . " AND `gperm_name` IN ('profile_show', 'profile_visible')";
$GLOBALS['xoopsDB']->queryF($sql);
}
@@ -107,21 +106,29 @@
}
-// remove old html template files
- $template_directory = XOOPS_ROOT_PATH . "/modules/" . $module->getVar('dirname', 'n') . "/templates/";
- $template_list = array_diff(scandir($template_directory), array('..', '.'));
- foreach ($template_list as $k => $v) {
- $fileinfo = new SplFileInfo($template_directory . $v);
- if ($fileinfo->getExtension() == 'html' && $fileinfo->getFilename() != 'index.html') {
- @unlink($template_directory . $v);
+ if ($oldversion < 186) {
+ // remove old html template files
+ $templateDirectory = XOOPS_ROOT_PATH . "/modules/" . $module->getVar('dirname', 'n') . "/templates/";
+ $template_list = array_diff(scandir($templateDirectory), array('..', '.'));
+ foreach ($template_list as $k => $v) {
+ $fileinfo = new SplFileInfo($templateDirectory . $v);
+ if ($fileinfo->getExtension() == 'html' && $fileinfo->getFilename() != 'index.html') {
+ @unlink($templateDirectory . $v);
+ }
}
+ // Load class XoopsFile
+ xoops_load('xoopsfile');
+ //remove /images directory
+ $imagesDirectory = XOOPS_ROOT_PATH . "/modules/" . $module->getVar('dirname', 'n') . "/images/";
+ $folderHandler = XoopsFile::getHandler("folder", $imagesDirectory);
+ $folderHandler->delete($imagesDirectory);
}
- $profile_handler =& xoops_getModuleHandler("profile", $module->getVar('dirname', 'n') );
+ $profile_handler =& xoops_getModuleHandler("profile", $module->getVar('dirname', 'n'));
$profile_handler->cleanOrphan($GLOBALS['xoopsDB']->prefix("users"), "uid", "profile_id");
- $field_handler =& xoops_getModuleHandler('field', $module->getVar('dirname', 'n') );
- $user_fields = $field_handler->getUserVars();
- $criteria = new Criteria("field_name", "('" . implode("', '", $user_fields) . "')", "IN");
+ $field_handler =& xoops_getModuleHandler('field', $module->getVar('dirname', 'n'));
+ $user_fields = $field_handler->getUserVars();
+ $criteria = new Criteria("field_name", "('" . implode("', '", $user_fields) . "')", "IN");
$field_handler->updateAll("field_config", 0, $criteria);
return true;
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/language/english/modinfo.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/language/english/modinfo.php 2014-05-25 10:51:18 UTC (rev 12548)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/language/english/modinfo.php 2014-05-25 10:52:42 UTC (rev 12549)
@@ -42,3 +42,6 @@
//1.62
define('_PROFILE_MI_ABOUT',"About");
define('_PROFILE_MI_HOME',"Home");
+//1.86
+define('_PROFILE_MI_PROFILE_CAPTCHA_STEP1',"Use Captcha after the second Registration step?");
+define('_PROFILE_MI_PROFILE_CAPTCHA_STEP1_DESC',"Select 'Yes' to add extra measure against Spam registration by bots" );
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/userinfo.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/userinfo.php 2014-05-25 10:51:18 UTC (rev 12548)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/userinfo.php 2014-05-25 10:52:42 UTC (rev 12549)
@@ -190,7 +190,7 @@
$results = $modules[$mid]->search('', '', 5, 0, $thisUser->getVar('uid') );
$count = count($results);
if (is_array($results) && $count > 0) {
- for ($i = 0; $i < $count; $i++ ) {
+ for ($i = 0; $i < $count; ++$i ) {
if (isset($results[$i]['image']) && $results[$i]['image'] != '') {
$results[$i]['image'] = XOOPS_URL . '/modules/' . $modules[$mid]->getVar('dirname', 'n') . '/' . $results[$i]['image'];
} else {
Modified: XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/xoops_version.php
===================================================================
--- XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/xoops_version.php 2014-05-25 10:51:18 UTC (rev 12548)
+++ XoopsCore/branches/2.5.x/2.5.7/htdocs/modules/profile/xoops_version.php 2014-05-25 10:52:42 UTC (rev 12549)
@@ -87,72 +87,38 @@
// Config items
-$modversion['config'][1]['name'] = 'profile_search';
-$modversion['config'][1]['title'] = '_PROFILE_MI_PROFILE_SEARCH';
-$modversion['config'][1]['description'] = '';
-$modversion['config'][1]['formtype'] = 'yesno';
-$modversion['config'][1]['valuetype'] = 'int';
-$modversion['config'][1]['default'] = 1;
+$modversion['config'][] = array(
+ 'name' => 'profile_search',
+ 'title' => '_PROFILE_MI_PROFILE_SEARCH',
+ 'description' => '',
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 1
+ );
+$modversion['config'][] = array(
+ 'name' => 'profileCaptchaAfterStep1',
+ 'title' => '_PROFILE_MI_PROFILE_CAPTCHA_STEP1',
+ 'description' => '_PROFILE_MI_PROFILE_CAPTCHA_STEP1_DESC',
+ 'formtype' => 'yesno',
+ 'valuetype' => 'int',
+ 'default' => 1
+ );
+
// Templates
-$i = 0;
-$i++;
-$modversion['templates'][$i]['file'] = 'profile_breadcrumbs.tpl';
-$modversion['templates'][$i]['description'] = '';
-
-$i++;
-$modversion['templates'][$i]['file'] = 'profile_form.tpl';
-$modversion['templates'][$i]['description'] = '';
-
-$i++;
-$modversion['templates'][$i]['file'] = 'profile_admin_fieldlist.tpl';
-$modversion['templates'][$i]['description'] = '';
-
-$i++;
-$modversion['templates'][$i]['file'] = 'profile_userinfo.tpl';
-$modversion['templates'][$i]['description'] = '';
-
-$i++;
-$modversion['templates'][$i]['file'] = 'profile_admin_categorylist.tpl';
-$modversion['templates'][$i]['description'] = '';
-
-$i++;
-$modversion['templates'][$i]['file'] = 'profile_search.tpl';
-$modversion['templates'][$i]['description'] = '';
-
-$i++;
-$modversion['templates'][$i]['file'] = 'profile_results.tpl';
-$modversion['templates'][$i]['description'] = '';
-
-$i++;
-$modversion['templates'][$i]['file'] = 'profile_admin_visibility.tpl';
-$modversion['templates'][$i]['description'] = '';
-
-$i++;
-$modversion['templates'][$i]['file'] = 'profile_admin_steplist.tpl';
-$modversion['templates'][$i]['description'] = '';
-
-$i++;
-$modversion['templates'][$i]['file'] = 'profile_register.tpl';
-$modversion['templates'][$i]['description'] = '';
-
-$i++;
-$modversion['templates'][$i]['file'] = 'profile_changepass.tpl';
-$modversion['templates'][$i]['description'] = '';
-
-$i++;
-$modversion['templates'][$i]['file'] = 'profile_editprofile.tpl';
-$modversion['templates'][$i]['description'] = '';
-
-$i++;
-$modversion['templates'][$i]['file'] = 'profile_userform.tpl';
-$modversion['templates'][$i]['description'] = '';
-
-$i++;
-$modversion['templates'][$i]['file'] = 'profile_avatar.tpl';
-$modversion['templates'][$i]['description'] = '';
-
-$i++;
-$modversion['templates'][$i]['file'] = 'profile_email.tpl';
-$modversion['templates'][$i]['description'] = '';
+$modversion['templates'][] = array('file' => "profile_breadcrumbs.tpl", 'description' => "");
+$modversion['templates'][] = array('file' => "profile_form.tpl", 'description' => "");
+$modversion['templates'][] = array('file' => "profile_admin_fieldlist.tpl", 'description' => "");
+$modversion['templates'][] = array('file' => "profile_userinfo.tpl", 'description' => "");
+$modversion['templates'][] = array('file' => "profile_admin_categorylist.tpl", 'description' => "");
+$modversion['templates'][] = array('file' => "profile_search.tpl", 'description' => "");
+$modversion['templates'][] = array('file' => "profile_results.tpl", 'description' => "");
+$modversion['templates'][] = array('file' => "profile_admin_visibility.tpl", 'description' => "");
+$modversion['templates'][] = array('file' => "profile_admin_steplist.tpl", 'description' => "");
+$modversion['templates'][] = array('file' => "profile_register.tpl", 'description' => "");
+$modversion['templates'][] = array('file' => "profile_changepass.tpl", 'description' => "");
+$modversion['templates'][] = array('file' => "profile_editprofile.tpl", 'description' => "");
+$modversion['templates'][] = array('file' => "profile_userform.tpl", 'description' => "");
+$modversion['templates'][] = array('file' => "profile_avatar.tpl", 'description' => "");
+$modversion['templates'][] = array('file' => "profile_email.tpl", 'description' => "");
|