Пример #1
0
 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;
 }
Пример #2
0
 function updateCommunityUserPrivacy($userid, $myprivacy)
 {
     // get params
     //self::reloadCUser($userid);
     $cuser = CFactory::getUser($userid);
     $myparams = $cuser->getParams();
     // if privacy handle by end user then dont update privacy.
     if (false == XiptLibPluginhandler::isPrivacyAllow()) {
         return true;
     }
     if (isset($myprivacy['jsPrivacyController'])) {
         unset($myprivacy['jsPrivacyController']);
     }
     foreach ($myprivacy as $key => $val) {
         $myparams->set($key, $val);
     }
     $params = $myparams->toString();
     $query = new XiptQuery();
     if (!$query->update('#__community_users')->set(" params = '{$params}' ")->where(" userid = {$userid} ")->dbLoadQuery()->query()) {
         return false;
     }
     /**
      *  Update user Photo Privacy Setting in user Album Tables
      */
     $params = $myparams->toArray();
     $query = new XiptQuery();
     if (!$query->update('#__community_photos_albums')->set(" permissions = '" . $params['privacyPhotoView'] . "' ")->where(" creator = {$userid} ")->dbLoadQuery()->query()) {
         return false;
     }
     /**
      *  Update user Vedio Privacy Setting in user Album Tables
      */
     //$params = $myparams->toArray();
     $query = new XiptQuery();
     if (!$query->update('#__community_videos')->set(" permissions = '" . $params['privacyVideoView'] . "'")->where(" creator = {$userid} ")->dbLoadQuery()->query()) {
         return false;
     }
     //default Privacy of every custom field is "public"
     $query = new XiptQuery();
     if (!$query->update('#__community_fields_values')->set(" access = 0")->where(" user_id = {$userid} ")->dbLoadQuery()->query()) {
         return false;
     }
     //		if(!$cuser->save( 'params' ))
     //			return false ;
     //enforce JomSocial to clean cached user
     self::reloadCUser($userid);
     return true;
 }