コード例 #1
0
ファイル: utils.php プロジェクト: Simarpreet05/joomla
 static function changePluginState($plugin, $state = 0)
 {
     $query = new XiptQuery();
     if (XIPT_JOOMLA_15) {
         $result = $query->update('#__plugins')->set(" `published` = {$state} ")->where(" `element` = '{$plugin}' ")->dbLoadQuery("", "")->query();
     } else {
         $result = $query->update('#__extensions')->set(" `enabled` = {$state} ")->where(" `element` = '{$plugin}' ")->dbLoadQuery("", "")->query();
     }
     return $result;
 }
コード例 #2
0
ファイル: jsfields.php プロジェクト: Simarpreet05/joomla
 function _switchFieldState($state)
 {
     $query = new XiptQuery();
     return $query->update('#__community_fields')->set(" published = '{$state}' ")->where(" type = 'profiletypes' ", 'OR')->where(" type = 'templates' ")->dbLoadQuery()->query();
 }
コード例 #3
0
ファイル: profiletypes.php プロジェクト: Simarpreet05/joomla
 function resetUserAvatar($pid, $newavatar, $oldavatar, $newavatarthumb)
 {
     //get all users for profiletype
     $users = XiptLibProfiletypes::getAllUsers($pid);
     //Change all avatar and thumb path in url formate
     $newavatar = XiptHelperUtils::getUrlpathFromFilePath($newavatar);
     $newavatarthumb = XiptHelperUtils::getUrlpathFromFilePath($newavatarthumb);
     $cnt = count($users);
     for ($i = 0; $i < $cnt; $i++) {
         //if user is admin unset value
         if (XiptHelperUtils::isAdmin($users[$i])) {
             unset($users[$i]);
         }
     }
     $users = array_values($users);
     $cnt = count($users);
     if ($cnt > 0) {
         // XITODO : Change IN query to sub query
         //update user avatar and thumb of all users who doesn't have custom avatar
         $query = new XiptQuery();
         $result = $query->update('#__community_users')->set(" avatar = '{$newavatar}' ")->set(" thumb = '{$newavatarthumb}' ")->where(" avatar = '{$oldavatar}' ")->where(" userid  IN (" . implode(",", $users) . ") ")->dbLoadQuery()->query();
         if (!$result) {
             return XiptError::raiseWarning(500, XiptText::_("ERROR_IN_DATABASE_WHEN_SAVING_AVATAR_IN_COMMUNITY_USER_TABLE"));
         }
         return true;
     }
 }
コード例 #4
0
ファイル: unhook.php プロジェクト: Simarpreet05/joomla
 function disableCustomFields()
 {
     $query = new XiptQuery();
     return $query->update('#__community_fields')->set(" `published` = 0 ")->where(" `type` = 'profiletypes' ", 'OR')->where(" `type` = 'templates' ", 'OR')->dbLoadQuery("", "")->query();
 }
コード例 #5
0
ファイル: jomsocial.php プロジェクト: Simarpreet05/joomla
 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;
 }