function _migratePrivacyParams() { $db = JFactory::getDBO(); $query = 'SELECT `id`,`privacy`,`params` FROM `#__xipt_profiletypes`'; $db->setQuery($query); $profiletypeResult = $db->loadObjectList(); for ($i = 0; $i < count($profiletypeResult); $i++) { //get profiletype privacy from privacy column $ update it into params $privacy = array(); $privacy['privacyprofile'] = self::_update_privacy_param($profiletypeResult[$i]->privacy); $JSParams = new XiptParameter($profiletypeResult[$i]->params); //do not inclde profileprivacy $privacyKey = array('privacyfriends', 'privacyphotos', 'privacyemail', 'privacyapps', 'privacywallcomment'); if (!empty($profiletypeResult[$i]->params)) { foreach ($privacyKey as $key) { if ($key !== 'privacyprofile') { $privacy[$key] = $JSParams->get($key); } } } $registry = XiptParameter(); $registry->loadArray($privacy, 'xipt_privacyparams'); $Privacyparams = $registry->toString('XiptINI', 'xipt_privacyparams'); $profiletypeResult[$i]->privacy = $Privacyparams; $query = 'UPDATE `#__xipt_profiletypes` ' . ' SET `privacy`=' . $db->Quote($Privacyparams) . ' WHERE `id`=' . $db->Quote($profiletypeResult[$i]->id); $db->setQuery($query); $db->query(); } }
function _saveWatermark($id) { $model = $this->getModel(); //Collect Newly saved data $newData = $model->loadRecords(0); $newData = $newData[$id]; $config = new XiptParameter('', ''); $config->bind($newData->watermarkparams); // if enable water mark is false then no need to create watermark if (!$config->get('enableWaterMark')) { return false; } //no change condition i.e if type of watermark is image // but no image is selected then return if (empty($_FILES['watermarkparams']['tmp_name']['xiImage']) && $config->get('typeofwatermark', '0') == '1') { return false; } // generate watermark image //XITODO : improve nomenclature $imageGenerator = new XiptLibImage($config); $storage = PROFILETYPE_AVATAR_STORAGE_PATH; $imageName = 'watermark_' . $id; // create watermark according to the type of watermark selected if ($config->get('typeofwatermark', '0') == '1') { $filename = $imageGenerator->createImageWatermark($storage, $imageName); } else { $filename = $imageGenerator->genImage($storage, $imageName); } //XITODO : assert on filename $image = PROFILETYPE_AVATAR_STORAGE_REFERENCE_PATH . DS . $filename; $data = array('watermark' => XiptHelperUtils::getUrlpathFromFilePath($image)); $this->generateThumbnail($imageName, $filename, $storage, $newData, $config); // now save model $model->save($data, $id); return $image; }
echo JURI::root() . XiptHelperUtils::getUrlpathFromFilePath($field->avatar); ?> " width="64" height="64" border="0" alt="<?php echo $field->avatar; ?> " /> </td> <td align="center" id="watermark<?php echo $field->id; ?> "> <?php $wm = $field->watermarkparams; $wmparams = new XiptParameter($wm, ''); if ($wmparams->get('enableWaterMark', 0)) { ?> <img src="<?php echo JURI::root() . XiptHelperUtils::getUrlpathFromFilePath($field->watermark); ?> " border="0" alt="<?php echo $field->watermark; ?> " /> <?php } ?> </td> <td align="center" id="jusertype<?php