function ajaxCheckUserName(&$args, &$response) { $pluginHandler = new XiptLibPluginhandler(); $ptype = $pluginHandler->isPTypeExistInSession(); if (!$ptype) { XiptError::assert($ptype, XiptText::_('PROFILE_TYPE_IS_NOT_SELECTED'), XiptError::WARNING); return false; } // as per JomSocial code $uname = $args[0]; if (XiptHelperRegistration::checkIfUsernameAllowed($uname, $ptype)) { return true; } // username not allowed $msg = XiptText::_('XIPT_USERNAME_NOT_ALLOWED'); $response->addScriptCall('jQuery("#jsusername").addClass("invalid");'); $response->addScriptCall('jQuery("#errjsusernamemsg").show();'); $response->addScriptCall('jQuery("#errjsusernamemsg").html("<br/>' . $msg . '");'); $response->addScriptCall('jQuery("#usernamepass").val("N");'); $response->addScriptCall('false;'); return false; }
function onAjaxCall(&$func, &$args, &$response) { $callArray = explode(',', $func); //perform Access checks $ajax = true; XiptAclHelper::performACLCheck($ajax, $callArray, $args); // If we come here means ACL Check was passed $controller = $callArray[0]; $function = $callArray[1]; switch ($controller . '_' . $function) { //before creating new account, validate email and username case 'connect_ajaxCreateNewAccount': return XiptHelperRegistration::ajaxCreateNewAccountFacebook($args, $response); case 'connect_ajaxCheckEmail': return XiptHelperRegistration::ajaxCheckEmailDuringFacebook($args, $response); case 'connect_ajaxCheckUsername': return XiptHelperRegistration::ajaxCheckUsernameDuringFacebook($args, $response); case 'connect_ajaxShowNewUserForm': return XiptHelperRegistration::ajaxShowNewUserForm($args, $response); case 'connect_ajaxUpdate': return XiptHelperRegistration::ajaxUpdate($args, $response); // when controller == register // when controller == register case 'register_ajaxCheckEmail': case 'register_ajaxCheckUserName': return XiptHelperRegistration::$function($args, $response); //when controller == apps //when controller == apps case 'apps_ajaxAddApp': case 'apps_ajaxAdd': $my = JFactory::getUser(); //XITODO : Remove it and add assert if (0 == $my->id) { return true; } $profiletype = XiptLibProfiletypes::getUserData($my->id, 'PROFILETYPE'); return XiptLibApps::filterAjaxAddApps($args[0], $profiletype, $response); case 'profile_ajaxConfirmRemoveAvatar': //case 'profile_ajaxConfirmRemovePicture': //case 'profile_ajaxConfirmRemovePicture': case 'profile_ajaxRemovePicture': // This case use for Admin panel return XiptLibAvatar::removeAvatar($args, $response); default: // we do not want to interfere, go ahead JomSocial return true; } }