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); }
function getMenusToHide($userid) { $jsmodel = XiptFactory::getInstance('jstoolbar', 'model'); $pID = XiptLibProfiletypes::getUserData($userid, 'PROFILETYPE'); $query = new XiptQuery(); $menuids = $query->select('menuid')->from('#__xipt_jstoolbar')->where(" `profiletype` = {$pID} ")->dbLoadQuery("", "")->loadResultArray(); if (empty($menuids)) { return false; } foreach ($menuids as $menuid) { $result = $jsmodel->getMenu($menuid); $hideMenu = XiptRoute::_("{$result->link}"); ob_start(); ?> joms.jQuery(document).ready(function(){ var menuUrl = "<?php echo $hideMenu; ?> ".replace(/\&\;/gi, "&"); joms.jQuery("a[href='" + menuUrl + "']").hide(); }); <?php $content = ob_get_contents(); ob_clean(); JFactory::getDocument()->addScriptDeclaration($content); } }
/** * Get an object of controller-corresponding Model. * @return XiptModel */ public function getModel($modelName = null) { // support for parameter if ($modelName === null) { $modelName = $this->getName(); } return XiptFactory::getInstance($modelName, 'Model'); }
function getNotAllowedCommunityAppsArray($profiletype) { $tempResult = XiptFactory::getInstance('applications', 'model')->loadRecords(0); foreach ($tempResult as $temp) { $result[$temp->profiletype][] = $temp->applicationid; } if (isset($result[$profiletype])) { return $result[$profiletype]; } else { return array(); } }
function getProfileTypeArray($aid) { XiptError::assert($aid, XiptText::_("APPLICATION_ID_CANNOT_BE_NULL"), XiptError::ERROR); $results = XiptFactory::getInstance('applications', 'model')->getProfileTypes($aid); if (empty($results)) { return array(XIPT_PROFILETYPE_ALL); } $allTypes = XiptHelperProfiletypes::getProfileTypeArray(); // array_values is user to arrange the array from index 0, //array_diff uses index starting from 1 return array_values(array_diff($allTypes, $results)); }
function getProfileTypeArray($fid, $for) { XiptError::assert($fid, XiptText::_("PROFILEFIELD_ID_CAN_NOT_BE_NULL"), XiptError::ERROR); //Load all profiletypes for the field $results = XiptFactory::getInstance('profilefields', 'model')->getProfileTypes($fid, $for); if (empty($results)) { return array(XIPT_PROFILETYPE_ALL); } $allTypes = XiptHelperProfiletypes::getProfileTypeArray(); // array_values is user to arrange the array from index 0, //array_diff uses index starting from 1 return array_values(array_diff($allTypes, $results)); }
public function getAclRulesInfo($filter = '', $join = 'AND') { $records = XiptFactory::getInstance('aclrules', 'model')->loadRecords(0); if (empty($filter)) { return $records; } foreach ($records as $record) { foreach ($filter as $name => $info) { if ($record->{$name} != $info) { unset($records[$record->id]); break; } } } return $records; }
/** * Get an object of model-corresponding table. * @return XiptTable */ public function getTable($tableName = null) { // support for parameter if ($tableName === null) { $tableName = $this->getName(); } return XiptFactory::getInstance($tableName, 'Table'); }
/** * fo Joomla 1.6 * @param $properties * @param $result * @param $error */ function onUserAfterDelete($properties, $result, $error) { if ($result == false || $error == true) { return true; } return XiptFactory::getInstance('users', 'model')->delete($properties['id']); }
<?php /** * @Copyright Ready Bytes Software Labs Pvt. Ltd. (C) 2010- author-Team Joomlaxi * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html **/ if (!defined('_JEXEC')) { die('Restricted access'); } $jsModel = XiptFactory::getInstance('jstoolbar', 'model'); ?> <script type="text/javascript" src="<?php echo JURI::root() . 'components/com_xipt/assets/js/jquery1.4.2.js'; ?> " ></script> <script type="text/javascript"> jQuery(document).ready(function($){ // for select all profile type $("a#ptypeSelectAll").click(function(){ $('div#xiptPtype').find(':checkbox').attr('checked', true); return false; }); // for select none $("a#ptypeSelectNone").click(function(){ $('div#xiptPtype').find(':checkbox').attr('checked', false); return false; }); // for copying the same setting to another app, block $("div#xiptOtherMenu").css('display','none');
<?php /** * @Copyright Ready Bytes Software Labs Pvt. Ltd. (C) 2010- author-Team Joomlaxi * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html **/ if (!defined('_JEXEC')) { die('Restricted access'); } $aModel = XiptFactory::getInstance('applications', 'model'); ?> <script type="text/javascript" src="<?php echo JURI::root() . 'components/com_xipt/assets/js/jquery1.4.2.js'; ?> " ></script> <script type="text/javascript"> jQuery(document).ready(function($){ // for select all profile type $("a#ptypeSelectAll").click(function(){ $('div#xiptPtype').find(':checkbox').attr('checked', true); return false; }); // for select none $("a#ptypeSelectNone").click(function(){ $('div#xiptPtype').find(':checkbox').attr('checked', false); return false; }); // for copying the same setting to another app, block $("div#xiptOtherApps").css('display','none');
function getParams($id, $what = 'params') { $model = XiptFactory::getInstance('Profiletypes', 'model'); $params = $model->loadParams($id, $what); return $params; }
function filterProfileTypeFields(&$fields, $selectedProfiletypeID, $from) { return XiptFactory::getInstance('profilefields', 'model')->getFieldsForProfiletype($fields, $selectedProfiletypeID, $from); }
function isPrivacyAllow($myProfileID = null) { static $result = null; if ($result != null) { return $result; } $modelObj = XiptFactory::getInstance('profiletypes', 'model'); if (empty($myProfileID)) { $myProfileID = XiptLibProfiletypes::getUserData(JFactory::getUser()->id, 'PROFILETYPE'); } $privacyParams = $modelObj->loadParams($myProfileID, 'privacy'); // jsPrivacyController == 1 means privacy handle by admin $result = 1 == $privacyParams->get('jsPrivacyController') ? true : false; return $result; }
function uploadAndSetImage($file, $id, $what) { $mainframe =& JFactory::getApplication(); CFactory::load('helpers', 'image'); $config = CFactory::getConfig(); $uploadLimit = (double) $config->get('maxuploadsize'); $uploadLimit = $uploadLimit * 1024 * 1024; // @rule: Limit image size based on the maximum upload allowed. if (filesize($file['tmp_name']) > $uploadLimit) { $mainframe->enqueueMessage(XiptText::_('IMAGE_FILE_SIZE_EXCEEDED'), 'error'); $mainframe->redirect(CRoute::_('index.php?option=com_xipt&view=profiletypes&task=edit&id=' . $id, false)); } if (!cValidImage($file['tmp_name'])) { $mainframe->enqueueMessage(XiptText::_('IMAGE_FILE_NOT_SUPPORTED'), 'error'); } else { switch ($what) { case 'avatar': $imageMaxWidth = AVATAR_WIDTH; $thumbWidth = AVATAR_WIDTH_THUMB; $thumbHeight = AVATAR_HEIGHT_THUMB; $imgPrefix = 'avatar_'; break; case 'watermark': $imageMaxWidth = WATERMARK_WIDTH; $thumbWidth = WATERMARK_WIDTH_THUMB; $thumbHeight = WATERMARK_HEIGHT_THUMB; $imgPrefix = 'watermark_'; break; } $storage = PROFILETYPE_AVATAR_STORAGE_PATH; $storageImage = $storage . DS . $imgPrefix . $id . cImageTypeToExt($file['type']); $storageThumbnail = $storage . DS . $imgPrefix . $id . '_thumb' . cImageTypeToExt($file['type']); $image = PROFILETYPE_AVATAR_STORAGE_REFERENCE_PATH . DS . $imgPrefix . $id . cImageTypeToExt($file['type']); //$thumbnail = PROFILETYPE_AVATAR_STORAGE_REFERENCE_PATH . $imgPrefix . $id.'_thumb' . cImageTypeToExt( $file['type'] ); //here check if folder exist or not. if not then create it. if (JFolder::exists($storage) == false) { JFolder::create($storage); } // Only resize when the width exceeds the max. if (!cImageResizePropotional($file['tmp_name'], $storageImage, $file['type'], $imageMaxWidth)) { $mainframe->enqueueMessage(XiptText::sprintf('COM_XIPT_ERROR_MOVING_UPLOADED_FILE', $storageImage), 'error'); } // Generate thumbnail if (!cImageCreateThumb($file['tmp_name'], $storageThumbnail, $file['type'], $thumbWidth, $thumbHeight)) { $mainframe->enqueueMessage(XiptText::sprintf('COM_XIPT_ERROR_MOVING_UPLOADED_FILE', $storageThumbnail), 'error'); } $oldFile = XiptLibProfiletypes::getProfiletypeData($id, $what); // If old file is default_thumb or default, we should not remove it. if (!Jstring::stristr($oldFile, DEFAULT_AVATAR) && !Jstring::stristr($oldFile, DEFAULT_AVATAR_THUMB) && $oldFile != $image && $oldFile != '') { // File exists, try to remove old files first. $oldFile = JString::str_ireplace('/', DS, $oldFile); //only delete when required if (JFile::exists($oldFile)) { JFile::delete($oldFile); } } //here due to extension mismatch we can break the functionality of avatar if ($what === 'avatar') { /* No need to update thumb here , script will update both avatar and thumb */ //$newThumb = XiptHelperImage::getThumbAvatarFromFull($newAvatar); $oldAvatar = XiptLibProfiletypes::getProfiletypeData($id, 'avatar'); $allUsers = XiptLibProfiletypes::getAllUsers($id); if ($allUsers) { $filter[] = 'avatar'; $newData['avatar'] = $image; $oldData['avatar'] = $oldAvatar; foreach ($allUsers as $userid) { XiptLibProfiletypes::updateUserProfiletypeFilteredData($userid, $filter, $oldData, $newData); } } } //now update profiletype with new avatar or watermark if (!XiptFactory::getInstance('profiletypes', 'model')->save(array($what => XiptHelperUtils::getUrlpathFromFilePath($image)), $id)) { XiptError::raiseError(__CLASS__ . '.' . __LINE__, XiptText::_("ERROR_IN_DATABASE")); } } }