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); } }
function save($post = null) { if ($post === null) { $post = JRequest::get('post'); } $menuid = isset($post['id']) ? $post['id'] : 0; $otherMenuid = isset($post['menuIds']) ? $post['menuIds'] : array(); $menuPtype = isset($post['profileTypes']) ? $post['profileTypes'] : array(); $allTypes = XiptHelperProfiletypes::getProfileTypeArray(); $model = $this->getModel(); // menuid is also selected in otherMenuid then no need to add if (!in_array($menuid, $otherMenuid)) { array_push($otherMenuid, $menuid); } //remove all rows related to specific menu id foreach ($otherMenuid as $id) { $model->delete(array('menuid' => $id)); } $msg = XiptText::_('MENU_SAVED'); $link = XiptRoute::_('index.php?option=com_xipt&view=jstoolbar', false); $this->setRedirect($link, $msg); //if all selected, return true if (array_diff($allTypes, $menuPtype) == array()) { return true; } $ptypesToChange = array_diff($allTypes, $menuPtype); foreach ($ptypesToChange as $type) { foreach ($otherMenuid as $id) { if ($this->getModel()->save(array('menuid' => $id, 'profiletype' => $type)) == false) { return false; } } } return true; }
function display($save = '', $pt = 0) { //trigger event $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onBeforeProfileTypeSelection'); // check for session // if does not exist redirect user to community page XiptHelperProfiletypes::checkSessionForProfileType(); //If not allowed to select PT for user then return if (XiptFactory::getSettings('show_ptype_during_reg') == 0) { $selectedProfiletypeID = XiptLibProfiletypes::getDefaultProfiletype(); XiptHelperProfiletypes::setProfileTypeInSession($selectedProfiletypeID); } // do some validation for visibility and publish of ptype if (JRequest::getVar('save', $save, 'POST') != '') { $selectedProfiletypeID = JRequest::getVar('profiletypes', $pt, 'POST'); if (XiptLibProfiletypes::validateProfiletype($selectedProfiletypeID, array('published' => 1, 'visible' => 1)) == false) { $msg = XiptText::_('INVALID_PROFILE_TYPE_SELECTED'); $link = XiptRoute::_('index.php?option=com_xipt&view=registration', false); $this->setRedirect($link, $msg); } $dispatcher->trigger('onAfterProfileTypeSelection', array(&$selectedProfiletypeID)); return true; } // Get the view $this->getView()->display(); }
function getMessage() { $requiredSetup = array(); if ($this->isRequired()) { $link = XiptRoute::_("index.php?option=com_xipt&view=setup&task=doApply&name=ptmigration", false); $requiredSetup['message'] = '<a href="' . $link . '">' . XiptText::_('PLEASE_CLICK_HERE_TO_MIGRATE_JS_MULTIPROFILES') . '</a>'; $requiredSetup['done'] = false; } return $requiredSetup; }
function getMessage() { $requiredSetup = array(); if ($this->isRequired()) { $link = XiptRoute::_("index.php?option=com_xipt&view=setup&task=doApply&name=aecmi", false); $requiredSetup['message'] = '<a href="' . $link . '">' . XiptText::_("PLEASE_CLICK_HERE_TO_INSTALL_JSPT_MI_INTO_AEC") . '</a>'; $requiredSetup['done'] = false; } else { $requiredSetup['message'] = XiptText::_("AEC_MI_ALREADY_THERE"); $requiredSetup['done'] = true; } return $requiredSetup; }
function getMessage() { $requiredSetup = array(); if ($this->isRequired()) { $link = XiptRoute::_("index.php?option=com_xipt&view=setup&task=doApply&name=payplans", false); $requiredSetup['message'] = '<a href="' . $link . '">' . XiptText::_("PLEASE_CLICK_HERE_TO_CREATE_APPS_IN_PAYPLANS") . '</a>'; $requiredSetup['done'] = false; } else { $requiredSetup['message'] = XiptText::_("PAYPLANS_IS_ALREADY_IN_SYNC"); $requiredSetup['done'] = true; } return $requiredSetup; }
function getMessage() { $requiredSetup = array(); if ($this->isRequired()) { $link = XiptRoute::_("index.php?option=com_xipt&view=setup&task=doApply&name=xiptplugin", false); $requiredSetup['message'] = '<a href="' . $link . '">' . XiptText::_("PLEASE_CLICK_HERE_TO_ENABLE_ESSENTIAL_SETTINGS") . '</a>'; $requiredSetup['done'] = false; } else { $requiredSetup['message'] = XiptText::_("ESSENTIALS_SETTINGS_DONE"); $requiredSetup['done'] = true; } return $requiredSetup; }
function unhook() { //get all files required for setup $setupNames = XiptSetupHelper::getOrderedRules(); foreach ($setupNames as $setup) { //get object of class $setupObject = XiptFactory::getSetupRule($setup['name']); $setupObject->doRevert(); } $msg = XiptText::_('UNHOOKED_SUCCESSFULLY'); $this->setRedirect(XiptRoute::_("index.php?option=com_xipt&view=setup&task=display", false), $msg); return true; }
function getMessage() { $requiredSetup = array(); if ($this->isRequired()) { $link = XiptRoute::_("index.php?option=com_xipt&view=setup&task=doApply&name=defaultprofiletype", false); $requiredSetup['message'] = '<a href="' . $link . '">' . XiptText::_("PLEASE_CLICK_HERE_TO_SET_DEFAULT_PROFILETYPE") . '</a>'; $requiredSetup['done'] = false; } else { $requiredSetup['message'] = XiptText::_("DEFAULT_PROFILETYPE_EXIST"); $requiredSetup['done'] = true; } return $requiredSetup; }
function getMessage() { $requiredSetup = array(); if ($this->isRequired()) { $link = XiptRoute::_("index.php?option=com_xipt&view=setup&task=doApply&name=createprofiletypes", false); $requiredSetup['message'] = '<a href="' . $link . '">' . XiptText::_("PLEASE_CLICK_HERE_TO_CREATE_PROFILETYPES") . '</a>'; $requiredSetup['done'] = false; } else { $requiredSetup['message'] = XiptText::_("PROFILETYPE_VALIDATION_SUCCESSFULL"); $requiredSetup['done'] = true; } return $requiredSetup; }
public function checkAclViolation($data) { $redirectUrl = XiptRoute::_($this->getRedirectUrl()); $redirectURI = new JURI($redirectUrl); $redirectVar = $redirectURI->getQuery(true); foreach ($redirectVar as $key => $value) { if (array_key_exists($key, $data)) { if ($value != $data[$key]) { return true; } } } return false; }
function reset($id = 0) { //XITODO : what to do if invalid id comes $id = JRequest::getVar('profileId', $id); $pModel = $this->getModel(); // Try to save configurations $save = $pModel->save(array('params' => ''), $id); if (XiptError::assert($save, XiptText::_('UNABLE_TO_RESET_PROFILETYPE_INTO_DATABASE_PLEASE_ENSURE_THAT_THE_TABLE_JOS_XIPT_PROFILETYPES_EXISTS'), XiptError::WARNING) == false) { return false; } $link = XiptRoute::_('index.php?option=com_xipt&view=configuration', false); $msg = XiptText::_('PROFILETYPE_HAS_BEEN_RESET'); $this->setRedirect($link, $msg); return true; }
function save($post = null) { if ($post === null) { $post = JRequest::get('post'); } $fid = isset($post['id']) ? $post['id'] : 0; $otherFids = isset($post['fieldIds']) ? $post['fieldIds'] : array(); $allTypes = XiptHelperProfiletypes::getProfileTypeArray(); $fieldModel = $this->getModel(); // fid is also selected in otherAid then no need to add if (!in_array($fid, $otherFids)) { array_push($otherFids, $fid); } //remove all rows related to specific field id // cleaning all data for storing new profiletype with fields foreach ($otherFids as $id) { $fieldModel->delete(array('fid' => $id)); } $categories = XiptHelperProfilefields::getProfileFieldCategories(); // for each category foreach ($categories as $catIndex => $catInfo) { $controlName = $catInfo['controlName']; $selectedPtypes = isset($post[$controlName]) ? $post[$controlName] : array(); // if all profile types are selected $ptypesToChange = array_diff($allTypes, $selectedPtypes); if ($ptypesToChange == array()) { continue; } // for each profile type foreach ($ptypesToChange as $type) { foreach ($otherFids as $id) { if ($this->getModel()->save(array('fid' => $id, 'pid' => $type, 'category' => $catIndex)) == false) { return false; } } } } $msg = XiptText::_('FIELDS_SAVED'); $link = XiptRoute::_('index.php?option=com_xipt&view=profilefields', false); $this->setRedirect($link, $msg); return true; }
function display($tpl = null) { // if user is already register then return to different URL $userId = JFactory::getUser()->id; if ($userId) { $redirectUrl = XiptRoute::_('index.php?option=com_community&view=profile', false); $msg = XiptText::_('YOU_ARE_ALREADY_REGISTERED_NEED_NOT_TO_REGISTER_AGAIN'); JFactory::getApplication()->redirect($redirectUrl, $msg); } // refine it, if empty will add default pType $allProfileTypes = array(); $seletedPTypeID = JRequest::getVar('ptypeid', ''); //TODO : trigger an API Event to add something to templates, or modify $profiletypes array // e.g. : I want to patch description. with some extra information $filter = array('published' => 1, 'visible' => 1); $allProfileTypes = XiptLibProfiletypes::getProfiletypeArray($filter); $this->assign('allProfileTypes', $allProfileTypes); $this->assign('selectedPT', $seletedPTypeID); $params = XiptFactory::getSettings('', 0); $this->assign('showAsRadio', $params->get('jspt_show_radio', true)); parent::display($tpl); }
function getMessage() { $requiredSetup = array(); if ($this->isRequired()) { $link = XiptRoute::_("index.php?option=com_xipt&view=setup&task=doApply&name=patchfiles", false); $requiredSetup['message'] = '<a href="' . $link . '">' . XiptText::_("PLEASE_CLICK_HERE_TO_PATCH_FILES") . '</a>'; $requiredSetup['done'] = false; } else { $requiredSetup['message'] = XiptText::_("FILES_ARE_PATCHED"); $requiredSetup['done'] = true; } return $requiredSetup; }
</td> <td> <?php echo $input; ?> </td> <td> <span class="editlinktip" title="<?php echo $rule->rulename; ?> " id="rulename<?php echo $rule->id; ?> "> <?php $link = XiptRoute::_('index.php?option=com_xipt&view=aclrules&task=edit&id=' . $rule->id, false); ?> <A HREF="<?php echo $link; ?> "><?php echo $rule->rulename; ?> </A> </span> </td> <td> <?php echo $rule->aclname; ?> </td>
function _hidePrivacyMenus() { if (false == $this->_pluginHandler->isPrivacyAllow()) { return; } //get Privacy menu if (XIPT_JOOMLA_15) { $menus = JSite::getMenu(); } else { //$menus = JApplication::getMenu('site'); //XiTODO::Improve this code; include_once JPATH_ROOT . DS . 'administrator/components/com_menus/models/items.php'; $menus = new MenusModelItems(); } $menusItems = $menus->getItems('menutype', CFactory::getConfig()->get('toolbar_menutype')); if (empty($menusItems)) { return; } foreach ($menusItems as $menu) { if (JString::stristr($menu->link, 'index.php?option=com_community&view=profile&task=privacy')) { $hideMenu = XiptRoute::_("{$menu->link}"); break; } } if (empty($hideMenu)) { return; } 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); }
public function handleViolation($info) { $msg = $this->getDisplayMessage(); if ($info['ajax']) { $this->aclAjaxBlock($msg); return $this; } $redirectUrl = $this->getRedirectUrl(); JFactory::getApplication()->redirect(XiptRoute::_($redirectUrl, false), $msg); }
"> <?php echo $id; ?> </span> </td> <td> <span class="editlinktip" title="<?php echo $field->name; ?> " id="name<?php echo $id; ?> "> <?php $link = XiptRoute::_('index.php?option=com_xipt&view=applications&task=edit&id=' . $id, false); ?> <A HREF="<?php echo $link; ?> "><?php echo $field->name; ?> </A> </span> </td> <td align="center" id="profiletype<?php echo $id; ?> "> <?php
<td><?php echo $field->id; ?> </td> <td> <span class="editlinktip" title="<?php echo $field->name; ?> " id="name<?php echo $field->id; ?> "> <?php $link = XiptRoute::_('index.php?option=com_xipt&view=profiletypes&task=edit&id=' . $field->id, false); ?> <a href="<?php echo $link; ?> "><?php echo $field->name; ?> </a> <?php $tmp = $field->tip; ?> <?php JFilterOutput::cleanText($tmp); ?> <br/>
function remove($ids = array()) { $ids = JRequest::getVar('cid', $ids, 'post', 'array'); $link = XiptRoute::_('index.php?option=com_xipt&view=profiletypes', false); $i = 1; //XITODO : Clean and commonize it $defaultPtype = XiptLibProfiletypes::getDefaultProfiletype(); foreach ($ids as $id) { // can not delete default profiletype if ($id == $defaultPtype) { $message = XiptText::_('CAN_NOT_DELETE_DEFAULT_PROFILE_TYPE'); JFactory::getApplication()->enqueueMessage($message); continue; } if (!$this->getModel()->delete($id)) { // If there are any error when deleting, we just stop and redirect user with error. $message = XiptText::_('ERROR_IN_REMOVING_PROFILETYPE'); $this->setRedirect($link, $message); return false; } $i++; } $message = $i - 1 . ' ' . XiptText::_('PROFILETYPE_REMOVED'); $this->setRedirect($link, $message); }
<?php /** * @Copyright Ready Bytes Software Labs Pvt. Ltd. (C) 2010- author-Team Joomlaxi * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html **/ // Disallow direct access to this file defined('_JEXEC') or die('Restricted access'); $css = JURI::root() . 'components/com_xipt/assets/style.css'; $document = JFactory::getDocument(); $document->addStyleSheet($css); ?> <form action="<?php echo XiptRoute::_('index.php?option=com_xipt&view=registration&reset=true', false); ?> " method="post" name="ptypeForm"> <div class="registerProfileType"> <h3 id="Title"><?php echo XiptText::_('CHOOSE_PROFILE_TYPE'); ?> </h3> <?php if (XiptFactory::getSettings('jspt_show_radio')) { echo $this->loadTemplate('click'); } else { echo $this->loadTemplate('select'); } ?> </div> <div class="clr" title="Next"></div>
function setProfileTypeInSession($selectedProfiletypeID) { // XITODO : move redirection to controller $mySess =& JFactory::getSession(); $redirectUrl = XiptHelperJomsocial::getReturnURL(); // validate values if (!XiptLibProfiletypes::validateProfiletype($selectedProfiletypeID)) { $msg = XiptText::_('PLEASE_ENTER_VALID_PROFILETYPE'); JFactory::getApplication()->redirect(XiptRoute::_('index.php?option=com_xipt&view=registration'), $msg); return; } //set value in session and redirect to destination url $mySess->set('SELECTED_PROFILETYPE_ID', $selectedProfiletypeID, 'XIPT'); JFactory::getApplication()->redirect($redirectUrl); }
function remove($ids = array()) { $ids = JRequest::getVar('cid', $ids, 'post', 'array'); $count = count($ids); $i = 1; foreach ($ids as $id) { if (!$this->getModel()->delete($id)) { // If there are any error when deleting, we just stop and redirect user with error. $message = XiptText::_('ERROR_IN_REMOVING_RULE'); $this->setRedirect('index.php?option=com_xipt&view=aclrules', $message); return false; } $i++; } $message = $count . ' ' . XiptText::_('RULE_REMOVED'); $link = XiptRoute::_('index.php?option=com_xipt&view=aclrules', false); $this->setRedirect($link, $message); }
</a> </span> </td> <?php } else { ?> <td> <span class="editlinktip" title="<?php echo $field->title; ?> " id="name<?php echo $id; ?> "> <?php $link = XiptRoute::_('index.php?option=com_xipt&view=jstoolbar&task=edit&id=' . $id, false); ?> <a href="<?php echo $link; ?> "><?php echo $field->title; ?> </a> </span> </td> <?php } ?> <td align="center" id="profiletype<?php echo $id;
function multidobool($task = 'enable', $cids = array(0)) { $task = JRequest::getVar('task', $task); $offpattern = '/^switchOff/'; $onpattern = '/^switchOn/'; if (preg_match($onpattern, $task)) { $switch = false; //$columninfo = str_split($task,strlen('switchOn')); $columninfo = explode('switchOn', $task); $column = array_key_exists(1, $columninfo) ? $columninfo[1] : ''; $value = 1; } else { if (preg_match($offpattern, $task)) { $switch = false; //$columninfo = str_split($task,strlen('switchOff')); $columninfo = explode('switchOff', $task); $column = array_key_exists(1, $columninfo) ? $columninfo[1] : ''; $value = 0; } else { XiptError::assert(0); } } $cids = JRequest::getVar('cid', $cids, 'post', 'array'); foreach ($cids as $cid) { if (!$this->_doBool($column, $value, $cid)) { XiptError::raiseError(__CLASS__ . '.' . __LINE__, XiptText::_("ERROR_IN_REORDERING_ITEMS")); } } //redirect now $this->setRedirect(XiptRoute::_("index.php?option=com_" . JString::strtolower($this->getPrefix()) . "&view={$this->getName()}"), sprintf(XiptText::_($task . '.MSG'), $cids)); return false; }
function integrateRegistrationWithPType() { $aecExists = XiptLibAec::isAecExists(); $payplansExists = XiptLibPayplans::isPayplansExists(); $subs_integrate = XiptFactory::getSettings('subscription_integrate', 0); $integrate_with = XiptFactory::getSettings('integrate_with', 0); $show_ptype_during_reg = XiptFactory::getSettings('show_ptype_during_reg', 0); $selectedProfiletypeID = $this->isPTypeExistInSession(); if ($show_ptype_during_reg) { $link = "index.php?option=com_xipt&view=registration"; // pType not selected : send to select profiletype if (!$selectedProfiletypeID) { $this->app->redirect(XiptRoute::_("index.php?option=com_xipt&view=registration", false)); return; } // pType already selected if ($aecExists && $subs_integrate && $integrate_with == 'aec') { $url = XiptRoute::_('index.php?option=com_acctexp&task=subscribe', false); $msg = XiptLibAec::getAecMessage(); if ($msg != false) { $link = '<a id="xipt_back_link" href=' . $url . '>' . XiptText::_("CLICK_HERE") . '</a>'; $this->app->enqueueMessage($msg . ' ' . $link); } return; } else { $url = XiptRoute::_('index.php?option=com_xipt&view=registration&ptypeid=' . $selectedProfiletypeID . '&reset=true', false); $selectedpTypeName = XiptLibProfiletypes::getProfiletypeName($selectedProfiletypeID); $msg = sprintf(XiptText::_('CURRENT_PTYPE_AND_CHANGE_PTYPE_OPTION'), $selectedpTypeName); $link = '<a id="xipt_back_link" href=' . $url . '>' . XiptText::_("CLICK_HERE") . '</a>'; $this->app->enqueueMessage($msg . ' ' . $link); return; } } else { if ($subs_integrate) { if ($payplansExists && $integrate_with == 'payplans') { $url = XiptRoute::_('index.php?option=com_payplans&view=plan', false); $msg = XiptLibPayplans::getPayplansMessage(); if ($msg != false) { $link = '<a id="xipt_back_link" href=' . $url . '>' . XiptText::_("CLICK_HERE") . '</a>'; $this->app->enqueueMessage($msg . ' ' . $link); } return; } } } // if pType is not set, collect default pType // set it in session if (!$selectedProfiletypeID) { $pType = $this->getRegistrationPType(); $this->setDataInSession('SELECTED_PROFILETYPE_ID', $pType); return; } return; }
?> </label> </div> <div class="paramValue"> <img src="<?php echo JURI::root() . XiptHelperUtils::getUrlpathFromFilePath($this->data->avatar); ?> " width="64" height="64" border="0" alt="<?php echo $this->data->avatar; ?> " /> <div class='clr'></div> <input class="inputbox button" type="file" id="file-upload" name="FileAvatar" style="color: #666;" /> <div class='clr'></div> <?php $link = XiptRoute::_('index.php?option=com_xipt&view=profiletypes&task=removeAvatar&id=' . $this->data->id . '&oldAvatar=' . $this->data->avatar, false); ?> <a href="<?php echo $link; ?> "><?php echo XiptText::_('REMOVE_AVTAR'); ?> </a> </div> </div> <div class="elementParams"> <div class="paramTitle"> <label class="hasTip" title="<?php echo XiptText::_('VISIBLE');
function getMessage() { $requiredSetup = array(); if (self::isRequired()) { $link = XiptRoute::_("index.php?option=com_xipt&view=setup&task=doApply&name=jsfields", false); $requiredSetup['message'] = '<a href="' . $link . '">' . XiptText::_("PLEASE_CLICK_HERE_TO_CREATE_AND_ENABLE_CUSTOM_FIELDS") . '</a>'; $requiredSetup['done'] = false; } else { $requiredSetup['message'] = XiptText::_("CUSTOM_FIELDS_EXIST"); $requiredSetup['done'] = true; } return $requiredSetup; }
function getHTML($start, $total, $limit) { ob_start(); ?> <div> <h3 style="width:100%; background:#7ac047;text-align:center;color:RED;padding:5px;font-weight:bold;"> <?php //show user reseted //can show 'reseting next 500 user' echo "Reset Page : DO NOT CLOSE THIS WINDOW WHILE SYNCRONIZATION "; ?> </h3> <?php $step = JRequest::getVar('step', 0); $end = ($step + 1) * $limit; //Number of user syn-cp when limit is greater then remaining user //if($limit > $total){ //$remain=$end = $total; //} // display Total users echo "<br /> Total " . ($total = $total + $limit * $step . " users for Syn-cp"); //dispaly syn-cp users echo "<br />Syncing-Up Users " . $step * $limit . " To " . $end . " "; $step++; $remain = $total - $limit * $step; //dispaly remaning users echo "<br />Remaining " . $remain . " Users"; ?> <script> window.onload = function() { setTimeout("xiredirect()", 3000); } function xiredirect(){ window.location = "<?php echo XiptRoute::_("index.php?option=com_xipt&view=setup&task=doApply&name=syncupusers&start={$start}&limit={$limit}&step={$step}"); ?> " } </script> </div> <?php $html = ob_get_contents(); ob_end_clean(); return $html; }