Exemplo n.º 1
0
 function getSettings($paramName = '', $defaultValue = 0)
 {
     $sModel = XiptFactory::getInstance('settings', 'model');
     $params = $sModel->getParams();
     if (!$params) {
         XiptError::raiseWarning('XIPT-SYSTEM-ERROR', 'JSPT PARAMS ARE NULL');
     }
     if (empty($paramName)) {
         return $params;
     }
     if ($paramName == 'aec_integrate') {
         $aec_integrate = $params->get('aec_integrate', 'aec');
         if ($aec_integrate == 'aec') {
             return $params->get('subscription_integrate', $defaultValue);
         } else {
             return $aec_integrate;
         }
     }
     if ($paramName == 'aec_message') {
         $aec_message = $params->get('aec_message', 'aec');
         if ($aec_message == 'aec') {
             return $params->get('subscription_message', $defaultValue);
         } else {
             return $aec_message;
         }
     }
     return $params->get($paramName, $defaultValue);
 }
Exemplo n.º 2
0
 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;
     }
 }
Exemplo n.º 3
0
 function isXMLFilePatchRequired()
 {
     $filename = JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'fields' . DS . 'customfields.xml';
     if (JFile::exists($filename)) {
         if (!is_readable($filename)) {
             XiptError::raiseWarning(sprintf(XiptText::_('FILE_IS_NOT_READABLE_PLEASE_CHECK_PERMISSION'), $filename));
         }
         $file = JFile::read($filename);
         if (!$file) {
             return false;
         }
         $searchString = PROFILETYPE_FIELD_TYPE_NAME;
         $count = substr_count($file, $searchString);
         if ($count >= 1) {
             return false;
         }
         return true;
     }
     return false;
 }
Exemplo n.º 4
0
 function generateThumbnail($imageName, $filename, $storage, $newData, $config)
 {
     require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'helpers' . DS . 'image.php';
     $fileExt = JFile::getExt($filename);
     $thumbnailName = 'watermark_' . $newData->id . '_thumb.' . $fileExt;
     $storageThumbnail = $storage . DS . $thumbnailName;
     $watermarkPath = $storage . DS . $imageName . '.' . $fileExt;
     $watermarkThumbWidth = $config->get('xiThumbWidth', 80);
     $watermarkThumbHeight = $config->get('xiThumbHeight', 20);
     // create a transparent blank image
     // if type of watermark is text call ImageCreateTrueColor else
     //else call imageCreateTransparent
     if ($config->get('typeofwatermark', '0') == '0') {
         $dstimg = ImageCreateTrueColor($watermarkThumbWidth, $watermarkThumbHeight);
     } else {
         $dstimg = XiptLibImage::imageCreateTransparent($watermarkThumbWidth, $watermarkThumbHeight);
     }
     $watermarkType = XiptHelperImage::getImageType($watermarkPath);
     $srcimg = cImageOpen($watermarkPath, $watermarkType);
     //XITODO : also support other formats
     if (imagecopyresampled($dstimg, $srcimg, 0, 0, 0, 0, $watermarkThumbWidth, $watermarkThumbHeight, $config->get('xiWidth', 64), $config->get('xiHeight', 64))) {
         //fix for permissions
         imagepng($dstimg, $storageThumbnail);
         chmod($storageThumbnail, 0744);
     } else {
         XiptError::raiseWarning('XIPT_THUMB_WAR', 'THUMBNAIL NOT SUPPORTED');
     }
     /*if(!cImageCreateThumb( $watermarkPath , $storageThumbnail , XiptHelperImage::getImageType($watermarkPath),$config->get(xiWidth,64)/2,$config->get(xiHeight,64)/2));
     		$info['msg'] .= sprintf(JText::_('ERROR MOVING UPLOADED FILE') , $storageThumbnail);*/
     return;
 }
Exemplo n.º 5
0
 function load($imgname)
 {
     if (!$imgname) {
         return false;
     }
     $filename1 = stripslashes($this->imgname);
     //XiTODO:: Use php fun rather than manually
     $extension = $this->getExtension($filename1);
     $extension = strtolower($extension);
     if ($extension != "png") {
         XiptError::raiseWarning('XIPT_THUMB_WAR', 'EXTENSION NOT SUPPORTED');
     } else {
         $uploadedfile = $this->imgpath;
         $src = imagecreatefrompng($uploadedfile);
     }
     return $src;
 }
Exemplo n.º 6
0
 function getDefaultProfiletype()
 {
     $refresh = XiptLibJomsocial::cleanStaticCache();
     static $defaultProfiletypeID = null;
     if ($defaultProfiletypeID && $refresh === false) {
         return $defaultProfiletypeID;
     }
     $defaultProfiletypeID = XiptFactory::getSettings('defaultProfiletypeID');
     if ($defaultProfiletypeID) {
         return $defaultProfiletypeID;
     }
     echo XiptFactory::getSettings()->render();
     XiptError::raiseWarning('DEF_PTYPE_REQ', 'DEFAULT PROFILE TYPE REQUIRED');
 }
Exemplo n.º 7
0
 function restoreBackUpAvatar($currImagePath)
 {
     $currImagePath = XiptHelperUtils::getRealPath($currImagePath);
     $avatarFileName = JFile::getName($currImagePath);
     if (JFile::exists(USER_AVATAR_BACKUP . DS . $avatarFileName) && JFile::copy(USER_AVATAR_BACKUP . DS . $avatarFileName, JPATH_ROOT . DS . $currImagePath)) {
         return true;
     }
     if (JFactory::getConfig()->getValue('debug')) {
         XiptError::raiseWarning("XIPT-SYSTEM-WARNING", "User avatar {" . USER_AVATAR_BACKUP . DS . $avatarFileName . "} in backup folder does not exist.");
     }
     return false;
 }