Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 function loadParams($id, $what = '')
 {
     $record = $this->loadRecords(0);
     $xmlPath = XIPT_FRONT_PATH_ASSETS . DS . 'xml' . DS . JString::strtolower($this->getName() . ".{$what}.xml");
     $iniPath = XIPT_FRONT_PATH_ASSETS . DS . 'ini' . DS . JString::strtolower($this->getName() . ".{$what}.ini");
     $iniData = JFile::read($iniPath);
     XiptError::assert(JFile::exists($xmlPath), sprintf(XiptText::_("FILE_DOES_NOT_EXIST"), $xmlPath), XiptError::ERROR);
     $config = new XiptParameter($iniData, $xmlPath);
     if (isset($record[$id])) {
         $config->bind($record[$id]->{$what});
     }
     return $config;
 }
Esempio n. 3
0
 function _migrateRegistrationConfig()
 {
     // add config column in profiletype table
     self::_add_column('config', 'text NOT NULL', '#__xipt_profiletypes');
     // get the parameters of registration email checks from settings table
     $db = JFactory::getDBO();
     $query = 'SELECT ' . $db->nameQuote('params') . ' FROM ' . $db->nameQuote('#__xipt_settings') . ' WHERE ' . $db->nameQuote('name') . ' = ' . $db->Quote('settings');
     $db->setQuery($query);
     $result = $db->loadResult();
     // get the required params in array form
     $params = new XiptParameter();
     $params->bind($result);
     $regconfig['jspt_restrict_reg_check'] = $params->get('jspt_restrict_reg_check', 0);
     $regconfig['jspt_prevent_username'] = $params->get('jspt_prevent_username', 'moderator; admin; support; owner; employee');
     $regconfig['jspt_allowed_email'] = $params->get('jspt_allowed_email', '');
     $regconfig['jspt_prevent_email'] = $params->get('jspt_prevent_email', '');
     // convert email settings into INI
     $regParams = new XiptParameter();
     $regParams->loadArray($regconfig);
     $regINI = $regParams->toString('XiptINI');
     // update the profile types table foe column config
     $query = 'UPDATE ' . $db->nameQuote('#__xipt_profiletypes') . ' SET ' . $db->nameQuote('config') . ' = ' . $db->Quote($regINI);
     $db->setQuery($query);
     $result = $db->query();
     // unsetthe email params which are not required for settings table
     $settingParamsArray = $params->toArray();
     unset($settingParamsArray['jspt_restrict_reg_check']);
     unset($settingParamsArray['jspt_prevent_username']);
     unset($settingParamsArray['jspt_allowed_email']);
     unset($settingParamsArray['jspt_prevent_email']);
     $settingParams = new XiptParameter();
     $settingParams->loadarray($settingParamsArray);
     $settingsINI = $settingParams->toString('XiptINI');
     // save again the whole params (filtered by email params) in settings table
     $query = 'UPDATE ' . $db->nameQuote('#__xipt_settings') . ' SET ' . $db->nameQuote('params') . ' = ' . $db->Quote($settingsINI);
     $db->setQuery($query);
     $result = $db->query();
 }