本文整理汇总了PHP中Phpfox::masscallback方法的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox::masscallback方法的具体用法?PHP Phpfox::masscallback怎么用?PHP Phpfox::masscallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phpfox
的用法示例。
在下文中一共展示了Phpfox::masscallback方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update($iUserId, $aVals, $aSpecial = array(), $bIsAccount = false)
{
if (!defined('PHPFOX_IS_CUSTOM_FIELD_UPDATE') && Phpfox::getParam('user.split_full_name')) {
if (empty($aVals['first_name']) || empty($aVals['last_name'])) {
return Phpfox_Error::set(Phpfox::getPhrase('user.please_fill_in_both_your_first_and_last_name'));
}
$aVals['full_name'] = $aVals['first_name'] . ' ' . $aVals['last_name'];
}
if (!empty($aVals['city_location'])) {
if (!Phpfox::getLib('validator')->check($aVals['city_location'], array('html', 'url'))) {
return Phpfox_Error::set(Phpfox::getPhrase('user.not_a_valid_city'));
}
}
if (isset($aVals['full_name']) && Phpfox::getParam('user.validate_full_name')) {
if (!Phpfox::getLib('validator')->check($aVals['full_name'], array('html', 'url'))) {
return Phpfox_Error::set(Phpfox::getPhrase('user.not_a_valid_name'));
}
//d(Phpfox::getParam('user.maximum_length_for_full_name')); d(strlen($aVals['full_name'])); d($aVals);die();
if (Phpfox::getParam('user.maximum_length_for_full_name') > 0 && strlen($aVals['full_name']) > Phpfox::getParam('user.maximum_length_for_full_name')) {
$aChange = array('iMax' => Phpfox::getParam('user.maximum_length_for_full_name'));
$sPhrase = Phpfox::getParam('user.display_or_full_name') == 'full_name' ? Phpfox::getPhrase('user.please_shorten_full_name', $aChange) : Phpfox::getPhrase('user.please_shorten_display_name', $aChange);
return Phpfox_Error::set($sPhrase);
}
}
if (!defined('PHPFOX_INSTALLER') && isset($aVals['full_name']) && $aVals['full_name'] == '­') {
return Phpfox_Error::set(Phpfox::getPhrase('user.not_a_valid_name'));
}
if (!$bIsAccount && Phpfox::getUserParam('user.can_edit_dob') && (empty($aVals['day']) || empty($aVals['month']) || empty($aVals['year']))) {
return Phpfox_Error::set(Phpfox::getPhrase('user.please_enter_your_date_of_birth'));
}
if (isset($aVals['relation']) && Phpfox::getUserParam('custom.can_have_relationship') && ($aVals['relation'] != $aVals['previous_relation_type'] || $aVals['relation_with'] != $aVals['previous_relation_with'])) {
if (isset($_POST['null']) && empty($_POST['null'])) {
$aVals['relation_with'] = null;
}
/* has the user defined another user to share this relationship with? */
Phpfox::getService('custom.relation.process')->updateRelationship($aVals['relation'], isset($aVals['relation_with']) ? $aVals['relation_with'] : null);
}
$oParseInput = Phpfox::getLib('parse.input');
$aInsert = array('dst_check' => isset($aVals['dst_check']) ? '1' : '0', 'language_id' => $aVals['language_id']);
if (!$bIsAccount) {
if (isset($aVals['country_iso'])) {
$aInsert['country_iso'] = $aVals['country_iso'];
// http://www.phpfox.com/tracker/view/15297/
$aCountryChildren = Phpfox::getService('core.country')->getChildren($aVals['country_iso']);
$bHasCountryChildren = !empty($aCountryChildren);
}
//$aInsert['birthday'] = (Phpfox::getUserParam('user.can_edit_dob') && isset($aVals['day']) && isset($aVals['month']) && isset($aVals['year']) ? Phpfox::getService('user')->buildAge($aVals['day'], $aVals['month'], $aVals['year']) : null);
$aInsert['birthday_search'] = Phpfox::getUserParam('user.can_edit_dob') && isset($aVals['day']) && isset($aVals['month']) && isset($aVals['year']) ? Phpfox::getLib('date')->mktime(0, 0, 0, $aVals['month'], $aVals['day'], $aVals['year']) : 0;
// http://www.phpfox.com/tracker/view/14726/
// if ($aInsert['birthday_search'] > 0)
if (isset($aInsert['birthday_search'])) {
$aInsert['birthday'] = date('mdY', $aInsert['birthday_search']);
}
if (Phpfox::getUserParam('user.can_edit_gender_setting') && isset($aVals['gender'])) {
$aInsert['gender'] = (int) $aVals['gender'];
}
}
if (isset($aVals['time_zone'])) {
$aInsert['time_zone'] = $aVals['time_zone'];
}
($sPlugin = Phpfox_Plugin::get('user.service_process_update_start')) ? eval($sPlugin) : false;
if (isset($aSpecial['changes_allowed']) && $aSpecial['changes_allowed'] > $aSpecial['total_user_change'] && Phpfox::getUserParam('user.can_change_own_user_name') && !Phpfox::getParam('user.profile_use_id') && isset($aVals['old_user_name']) && $aVals['user_name'] != $aVals['old_user_name']) {
// http://www.phpfox.com/tracker/view/15155/
$aVals['user_name'] = str_replace(' ', '-', $aVals['user_name']);
$aVals['user_name'] = str_replace('_', '-', $aVals['user_name']);
Phpfox::getService('user.validate')->user($aVals['user_name']);
if (!Phpfox_Error::isPassed()) {
return false;
}
$aInsert['user_name'] = $aVals['user_name'];
$this->database()->updateCounter('user_field', 'total_user_change', 'user_id', $iUserId);
}
// updating the full name
if (isset($aSpecial['full_name_changes_allowed']) && ($aSpecial['full_name_changes_allowed'] > $aSpecial['total_full_name_change'] || $aSpecial['full_name_changes_allowed'] == 0) && Phpfox::getUserParam('user.can_change_own_full_name') && $aSpecial['current_full_name'] != $aVals['full_name']) {
if (Phpfox::getLib('parse.format')->isEmpty($aVals['full_name'])) {
Phpfox_Error::set(Phpfox::getPhrase('user.provide_a_name_that_is_not_representing_an_empty_name'));
}
if (!Phpfox::getService('ban')->check('display_name', $aVals['full_name'])) {
Phpfox_Error::set(Phpfox::getPhrase('user.this_display_name_is_not_allowed_to_be_used'));
}
if (!Phpfox_Error::isPassed()) {
return false;
}
$aInsert['full_name'] = $oParseInput->clean($aVals['full_name'], 255);
if ($aSpecial['full_name_changes_allowed'] > 0) {
$this->database()->updateCounter('user_field', 'total_full_name_change', 'user_id', $iUserId);
}
}
$sFullName = Phpfox::getUserBy('full_name');
$this->database()->update($this->_sTable, $aInsert, 'user_id = ' . (int) $iUserId);
$aInsert['prev_full_name'] = $sFullName;
Phpfox::masscallback('onUserUpdate', $aInsert);
if ($sPlugin = Phpfox_Plugin::get('user.service_process_update_1')) {
eval($sPlugin);
if (isset($mPluginReturn)) {
return $mPluginReturn;
}
}
if (!$bIsAccount) {
if ($bHasCountryChildren && isset($aVals['country_child_id'])) {
//.........这里部分代码省略.........