function showGeneralLink() { if ($this->conf->display_general_menu == 1) { ?> <div id="adsmanager_innermenu"> <?php if ($this->catid == 0) { $link_write_ad = TRoute::_("index.php?option=com_adsmanager&task=write"); } else { $link_write_ad = TRoute::_("index.php?option=com_adsmanager&task=write&catid={$this->catid}"); } $link_show_profile = TLink::getProfileLink(); $link_show_user = TLink::getMyAdsLink(); $link_show_rules = TRoute::_("index.php?option=com_adsmanager&view=rules"); $link_show_all = TRoute::_("index.php?option=com_adsmanager&view=list"); echo '<a href="' . $link_write_ad . '">' . JText::_('ADSMANAGER_MENU_WRITE') . '</a> | '; echo '<a href="' . $link_show_all . '">' . JText::_('ADSMANAGER_MENU_ALL_ADS') . '</a> | '; echo '<a href="' . $link_show_profile . '">' . JText::_('ADSMANAGER_MENU_PROFILE') . '</a> | '; echo '<a href="' . $link_show_user . '">' . JText::_('ADSMANAGER_MENU_USER_ADS') . '</a>'; if ($this->conf->rules_text != "") { echo ' | <a href="' . $link_show_rules . '">' . JText::_('ADSMANAGER_MENU_RULES') . '</a>'; } ?> </div> <br/> <?php } }
function showGeneralLink() { if ($this->conf->display_general_menu == 1) { ?> <div id="adsmanager_innermenu" class="row-fluid"> <div class="span12 text-center"> <?php if ($this->catid == 0) $link_write_ad = TRoute::_("index.php?option=com_adsmanager&task=write"); else $link_write_ad = TRoute::_("index.php?option=com_adsmanager&task=write&catid={$this->catid}"); $link_show_profile = TLink::getProfileLink(); $link_show_user = TLink::getMyAdsLink(); $link_show_rules = TRoute::_("index.php?option=com_adsmanager&view=rules"); $link_show_all = TRoute::_("index.php?option=com_adsmanager&view=list"); $link_favorites = TLink::getMyFavoritesLink(); echo '<a href="'.$link_write_ad.'">'.JText::_('ADSMANAGER_MENU_WRITE').'</a> | '; echo '<a href="'.$link_show_all.'">'.JText::_('ADSMANAGER_MENU_ALL_ADS').'</a> | '; echo '<a href="'.$link_show_profile.'">'.JText::_('ADSMANAGER_MENU_PROFILE').'</a> | '; echo '<a href="'.$link_show_user.'">'.JText::_('ADSMANAGER_MENU_USER_ADS').'</a>'; if(isset($this->conf->favorite_enabled) && $this->conf->favorite_enabled == 1){ echo ' | <a href="'.$link_favorites.'">'.JText::_('ADSMANAGER_MENU_FAVORITES').'</a>'; } if ($this->conf->rules_text != "") { echo ' | <a href="'.$link_show_rules.'">'.JText::_('ADSMANAGER_MENU_RULES').'</a>'; } ?> </div> </div> <?php } }
function display($tpl = null) { $app = JFactory::getApplication(); $user = JFactory::getUser(); $pathway = $app->getPathway(); $document = JFactory::getDocument(); $usermodel =$this->getModel( "user" ); $configurationmodel =$this->getModel( "configuration" ); $fieldmodel =$this->getModel( "field" ); $userid = $user->id; if ($userid == 0) { TTools::redirectToLogin(TLink::getProfileLink()); } else { $conf = $configurationmodel->getConfiguration(); if ((COMMUNITY_BUILDER == 1)||(JOMSOCIAL == 1)) { $app->redirect( TLink::getProfileLink() ); } else { $fields = $usermodel->getProfileFields(); $plugins = $fieldmodel->getPlugins(); $field_values = $fieldmodel->getFieldValues(); foreach($fields as $field) { if ($field->cbfieldvalues != "-1") { /*get CB value fields */ $cbfieldvalues = $fieldmodel->getCBFieldValues($field->cbfieldvalues); $field_values[$field->fieldid] = $cbfieldvalues; } } $field = new JHTMLAdsmanagerField($conf,$field_values,"1",$plugins); $user = $usermodel->getProfile($userid); $this->assignRef('field',$field); $this->assignRef('fields',$fields); $this->assignRef('user',$user); } } $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('adsmanagercontent'); $event = new stdClass(); $results = $dispatcher->trigger('ADSonUserAfterForm', array ($user)); $event->onUserAfterForm = trim(implode("\n", $results)); $this->assignRef('event',$event); $document->setTitle( JText::_('ADSMANAGER_PAGE_TITLE')); parent::display($tpl); }
function saveprofile() { $app = JFactory::getApplication(); // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $user = JFactory::getUser(); $this->addModelPath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_adsmanager' . DS . 'models'); $usermodel = $this->getModel("user"); $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('adsmanagercontent'); try { $results = $dispatcher->trigger('ADSonUserBeforeSave', array()); } catch (Exception $e) { $errorMsg = $e->getMessage(); $app->redirect(TLink::getProfileLink(), $errorMsg, 'message'); } $user->orig_password = $user->password; $password = JRequest::getVar('password', ""); $verifyPass = JRequest::getVar('verifyPass', ""); if ($password != "") { if ($verifyPass == $password) { jimport('joomla.user.helper'); $salt = JUserHelper::genRandomPassword(32); $crypt = JUserHelper::getCryptedPassword($password, $salt); $user->password = $crypt . ':' . $salt; } else { $app->redirect(TLink::getProfileLink(), JText::_('_PASS_MATCH'), 'message'); exit; } } else { // Restore 'original password' $user->password = $user->orig_password; } $user->name = JRequest::getVar('name', ""); $user->username = JRequest::getVar('username', ""); $user->email = JRequest::getVar('email', ""); unset($user->orig_password); // prevent DB error!! if (!$user->save()) { $app->redirect(TLink::getProfileLink(), $user->getError(), 'message'); } $fieldmodel = $this->getModel("field"); $usermodel->updateProfileFields($user->id, $fieldmodel->getPlugins()); $app->redirect(TLink::getProfileLink(), JText::_('ADSMANAGER_PROFILE_SAVED'), 'message'); }
$cc = $catmodel->getCategories(true, "read", $rootid); $orderlist = array(); // first pass - collect children foreach ($cc as $v) { $orderlist[$v->id] = $v; } $current_list[] = $catid; if ($catid != -1) { $current = $catid; while (isset($orderlist[$current]) && $orderlist[$current]->parent != 0) { $current_list[] = $orderlist[$current]->parent; $current = $orderlist[$current]->parent; } } } $link_show_profile = TLink::getProfileLink(); $link_show_user = TLink::getMyAdsLink(); $user = JFactory::getUser(); if ($rootid != 0) { $urlparamroot = "&rootid={$rootid}"; } else { $urlparamroot = ""; } $link_front = TRoute::_("index.php?option=com_adsmanager&view=front{$urlparamroot}"); $link_write_ad = TRoute::_("index.php?option=com_adsmanager&task=write{$urlparamroot}"); $link_show_rules = TRoute::_("index.php?option=com_adsmanager&view=rules{$urlparamroot}"); $link_show_all = TRoute::_("index.php?option=com_adsmanager&view=list{$urlparamroot}"); $link_favorites = TLink::getMyFavoritesLink(); require JModuleHelper::getLayoutPath('mod_adsmanager_menu', $params->get('layout', 'default')); $content = ""; $path = JPATH_ADMINISTRATOR . '/../libraries/joomla/database/table';