Example #1
1
 public function getInput()
 {
     jimport('joomla.filesystem.file');
     $mainframe = JFactory::getApplication();
     if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/libraries/MCAPI.class.php')) {
         $mainframe->enqueueMessage(JText::_('JM_PLEASE_INSTALL_JOOMLAMAILER'), 'error');
         $mainframe->redirect('index.php');
     }
     $listId = $this->form->getValue('listid', 'params');
     require_once JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/libraries/MCAPI.class.php';
     $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
     $MCapi = $params->get('params.MCapi');
     $api = new joomlamailerMCAPI($MCapi);
     $interests = $api->listInterestGroupings($listId);
     $options = array();
     if ($interests) {
         foreach ($interests as $interest) {
             if ($interest['form_field'] != 'hidden') {
                 $groups = array();
                 foreach ($interest['groups'] as $ig) {
                     $groups[] = $ig['name'];
                 }
                 $groups = implode('####', $groups);
                 $options[] = array('id' => $interest['id'] . ';' . $interest['form_field'] . ';' . $interest['name'] . ';' . $groups, 'name' => $interest['name']);
             }
         }
     }
     if (count($options)) {
         return JHtml::_('select.genericlist', $options, 'jform[params][interests][]', 'multiple="multiple"', 'id', 'name', $this->value, $this->id);
     } else {
         return JText::_('JM_NO_INTEREST_GROUPS');
     }
 }
 /**
  * Generates a list of JSON items.
  *
  * @return    void
  */
 public function display($tpl = null)
 {
     $model = $this->getModel();
     $this->item = $this->get('Item');
     $this->component = $model->getState($model->getName() . '.component');
     $this->section = $model->getState($model->getName() . '.section');
     $this->asset_id = $model->getState($model->getName() . '.asset_id');
     $this->project_id = $model->getState($model->getName() . '.project_id');
     $this->inherit = $model->getState($model->getName() . '.inherit');
     if (!$this->asset_id && $this->inherit) {
         $this->asset_id = $this->getComponentProjectAssetId($this->component, $this->project_id);
     }
     $this->rules = $this->getAssetRules();
     $this->public_groups = array('1', JComponentHelper::getParams('com_users')->get('guest_usergroup', 1));
     $user = JFactory::getUser();
     if (!$user->authorise('core.admin', $this->component) && !$user->authorise('core.manage', $this->component)) {
         JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
         return false;
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     parent::display($tpl);
 }
Example #3
1
	public function onAfterRoute()
	{
		$app = JFactory::getApplication();

		if($app->isAdmin()){
			return;
		}

		$menus = $app->getMenu('site');
		$menu = $menus->getActive();
		if(!$menu || $menu->home != 1) return;

		$doc = JFactory::getDocument();
		if($doc->getType() != 'html') return;

		$params = JComponentHelper::getParams('com_xmlrpc');

		if($params->get('show_rsd', 1)){
			class_exists('XMLRPCHelperRoute') or require(JPATH_SITE.'/components/com_xmlrpc/helpers/route.php');
			$link = JRoute::_(XMLRPCHelperRoute::getRsdRoute());
			$doc->addHeadLink($link, 'EditURI', 'rel', array('type' => 'application/rsd+xml', 'title'=>'RSD'));
		}

		if($params->get('show_manifest', 1)){
			class_exists('XMLRPCHelperRoute') or require(JPATH_SITE.'/components/com_xmlrpc/helpers/route.php');
			$link = JRoute::_(XMLRPCHelperRoute::getManifestRoute());
			$doc->addHeadLink($link, 'wlwmanifest', 'rel', array('type'=>'application/wlwmanifest+xml'));
		}
	}
Example #4
1
 /**
  * constructor (registers additional tasks to methods)
  * @return void
  */
 function __construct()
 {
     parent::__construct();
     // Set reference to parameters
     $this->params = JComponentHelper::getParams('com_chessvn');
     //$dummy = $this->params->get('parm_text');
 }
Example #5
1
 function display($tpl = null)
 {
     global $mainframe;
     // Check if registration is allowed
     $usersConfig =& JComponentHelper::getParams('com_users');
     if (!$usersConfig->get('allowUserRegistration')) {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
     $pathway =& $mainframe->getPathway();
     $document =& JFactory::getDocument();
     $params =& $mainframe->getParams();
     // Page Title
     $menus =& JSite::getMenu();
     $menu = $menus->getActive();
     // because the application sets a default page title, we need to get it
     // right from the menu item itself
     if (is_object($menu)) {
         $menu_params = new JParameter($menu->params);
         if (!$menu_params->get('page_title')) {
             $params->set('page_title', JText::_('Registration'));
         }
     } else {
         $params->set('page_title', JText::_('Registration'));
     }
     $document->setTitle($params->get('page_title'));
     $pathway->addItem(JText::_('New'));
     // Load the form validation behavior
     JHTML::_('behavior.formvalidation');
     $user =& JFactory::getUser();
     $this->assignRef('user', $user);
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
Example #6
1
	function __construct() {
		
		$app	= JFactory::getApplication();
		
		parent::__construct();
		
		$config = JFactory::getConfig();		
		
		$paramsC 			= JComponentHelper::getParams('com_phocadownload') ;
		$defaultPagination	= $paramsC->get( 'default_pagination', '20' );
		$file_ordering		= $paramsC->get( 'file_ordering', 1 );
		$context			= $this->_context.'.';
		
		// Get the pagination request variables
		$this->setState('limit', $app->getUserStateFromRequest($context.'limit', 'limit', $defaultPagination, 'int'));
		$this->setState('limitstart', $app->input->get('limitstart', 0, 'int'));

		// In case limit has been changed, adjust limitstart accordingly
		$this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0));
		
		$this->setState('filter.language',$app->getLanguageFilter());
		
		$this->setState('fileordering', $app->getUserStateFromRequest($context .'fileordering', 'fileordering', $file_ordering, 'int'));

		// Get the filter request variables
		$this->setState('filter_order', JRequest::getCmd('filter_order', 'ordering'));
		$this->setState('filter_order_dir', JRequest::getCmd('filter_order_Dir', 'ASC'));
		
	}
Example #7
1
 function addEvForm()
 {
     $listid = JRequest::getInt('listid');
     $viewName = 'calendar';
     $usersConfig = JComponentHelper::getParams('com_fabrik');
     $model =& $this->getModel($viewName);
     $id = JRequest::getInt('visualizationid', $usersConfig->get('visualizationid', 0));
     $model->setId($id);
     $model->setupEvents();
     if (array_key_exists($listid, $model->_events)) {
         $datefield = $model->_events[$listid][0]['startdate'];
     } else {
         $config = JFactory::getConfig();
         $prefix = $config->getValue('config.dbprefix');
         $datefield = $prefix . 'fabrik_calendar_events___start_date';
     }
     $rowid = JRequest::getInt('rowid');
     $listModel = JModel::getInstance('list', 'FabrikFEModel');
     $listModel->setId($listid);
     $table = $listModel->getTable();
     JRequest::setVar('view', 'form');
     JRequest::setVar('formid', $table->form_id);
     JRequest::setVar('tmpl', 'component');
     JRequest::setVar('ajax', '1');
     $link = 'index.php?option=com_fabrik&view=form&formid=' . $table->form_id . '&rowid=' . $rowid . '&tmpl=component&ajax=1';
     $link .= '&jos_fabrik_calendar_events___visualization_id=' . JRequest::getInt('jos_fabrik_calendar_events___visualization_id');
     $start_date = JRequest::getVar('start_date', '');
     if (!empty($start_date)) {
         $link .= "&{$datefield}=" . $start_date;
     }
     // $$$ rob have to add this to stop the calendar filtering itself after adding an new event?
     $link .= '&clearfilters=1';
     $this->setRedirect($link);
 }
Example #8
1
 /**
  * @brief Accion que se encarga de manipular el proceso de guardar
  * un archivo en el servidor
  * @param array $allowedExtensions Arreglo de extensiones validas para el archivo
  * @param int $sizeLimit Tamaño maximo permitido del fichero que se sube
  */
 function upload($allowedExtensions, $sizeLimit = 10485760)
 {
     jimport('Amadeus.Util.Uploader');
     $media =& JComponentHelper::getParams('com_media');
     $postSize = $this->toBytes(ini_get('post_max_size'));
     $uploadSize = $this->toBytes(ini_get('upload_max_filesize'));
     $mediaSize = (int) $media->get('upload_maxsize');
     // Se selecciona el minimo tamaño válido para un fichero, de acuerdo
     // a los valores configurados en el php, el joomla y el componente.
     $sizeLimit = min($postSize, $uploadSize, $mediaSize, $sizeLimit);
     // Se alamacena la imagen en la ruta especificada
     $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);
     $result = $uploader->handleUpload(JPATH_SITE . '/tmp/', true);
     if (!isset($result['error'])) {
         jimport('Amadeus.Util.Validation');
         $file = $uploader->getName();
         $result = AmadeusUtilValidation::isValidFile($file, $only_image);
         if (isset($result['error'])) {
             jimport('joomla.filesystem.file');
             if (!JFile::delete($file)) {
                 $result = array('error' => JText::_('DELETEERROR'));
             }
         } else {
             $this->_file = $file;
         }
     }
     return $result;
 }
Example #9
0
 protected function addToolbar()
 {
     $user = JFactory::getUser();
     $par = JComponentHelper::getParams('com_djclassifieds');
     JToolBarHelper::title(JText::_('COM_DJCLASSIFIEDS_ITEMS'), 'generic.png');
     if ($user->authorise('core.create', 'com_djclassifieds')) {
         JToolBarHelper::addNew('item.add', 'JTOOLBAR_NEW');
     }
     if ($user->authorise('core.edit', 'com_djclassifieds')) {
         JToolBarHelper::editList('item.edit', 'JTOOLBAR_EDIT');
     }
     JToolBarHelper::divider();
     if ($user->authorise('core.admin', 'com_djclassifieds')) {
         if ($par->get('store_org_img', '1') == 1) {
             JToolBarHelper::custom('items.recreateThumbnails', 'move', 'move', JText::_('COM_DJCLASSIFIEDS_RECREATE_THUMBNAILS'), true, true);
         }
         JToolBarHelper::custom('items.resmushitThumbnails', 'loop', 'loop', JText::_('COM_DJCLASSIFIEDS_OPTIMIZE_THUMBNAILS'), true, true);
         JToolBarHelper::custom('items.generateCoordinates', 'refresh', 'refresh', JText::_('COM_DJCLASSIFIEDS_GENERATE_COORDINATES'), false, true);
         JToolBarHelper::divider();
     }
     if ($user->authorise('core.edit.state', 'com_djclassifieds')) {
         JToolBarHelper::custom('items.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
         JToolBarHelper::custom('items.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
         JToolBarHelper::custom('items.archive', 'archive.png', 'archive_f2.png', 'JTOOLBAR_ARCHIVE', true);
     }
     if ($user->authorise('core.delete', 'com_djclassifieds')) {
         JToolBarHelper::deleteList('', 'items.delete', 'JTOOLBAR_DELETE');
     }
     JToolBarHelper::divider();
     if ($user->authorise('core.admin', 'com_djclassifieds')) {
         JToolBarHelper::preferences('com_djclassifieds', 450, 800);
         JToolBarHelper::divider();
     }
 }
 public function display($tpl = null)
 {
     $this->option = JFactory::getApplication()->input->get('option');
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     // Get parameters of com_crowdfunding.
     /** @var  $cParams Joomla\Registry\Registry */
     $cParams = JComponentHelper::getParams('com_crowdfunding');
     $this->cfParams = $cParams;
     $currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->cfParams->get('project_currency'));
     $this->amount = new Crowdfunding\Amount($this->cfParams);
     $this->amount->setCurrency($currency);
     // Get rewards number
     $projectsIds = array();
     foreach ($this->items as $item) {
         $projectsIds[] = $item->id;
     }
     $projects = new Crowdfunding\Projects(JFactory::getDbo());
     $this->transactions = $projects->getTransactionsNumber($projectsIds);
     // Prepare sorting data
     $this->prepareSorting();
     // Prepare actions
     $this->addToolbar();
     $this->addSidebar();
     $this->setDocument();
     parent::display($tpl);
 }
 function save()
 {
     // Check for request forgeries
     JRequest::checkToken() or die('COM_JOOMLEAGUE_GLOBAL_INVALID_TOKEN');
     $cid = JRequest::getInt("cid", 0);
     $post = JRequest::get('post');
     if ($cid > 0) {
         $club =& JTable::getInstance("Club", "Table");
         $club->load($cid);
         $club->bind($post);
         $params =& JComponentHelper::getParams('com_joomleague');
         if ($club->store() && $params->get('cfg_edit_club_info_update_notify') == "1") {
             $db = JFactory::getDBO();
             $user = JFactory::getUser();
             $query = "SELECT email\n                         FROM #__users \n                         WHERE usertype = 'Super Administrator' \n                            OR usertype = 'Administrator'";
             $db->setQuery($query);
             $to = $db->loadResultArray();
             $subject = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_SUBJECT"), $club->name));
             $message = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_MESSAGE"), $user->name, $club->name));
             $message .= $this->_getShowClubInfoLink();
             JUtility::sendMail('', '', $to, $subject, $message);
         }
     }
     $this->setRedirect($this->_getShowClubInfoLink());
 }
Example #12
0
 protected function populateState($ordering = null, $direction = null)
 {
     // Load the component parameters.
     $params = JComponentHelper::getParams($this->option);
     $this->setState('params', $params);
     // Load filter search.
     $value = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $value);
     // Load filter state.
     $value = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string');
     $this->setState('filter.state', $value);
     // Load filter approved state.
     $value = $this->getUserStateFromRequest($this->context . '.filter.approved', 'filter_approved', '', 'string');
     $this->setState('filter.approved', $value);
     // Load filter featured state.
     $value = $this->getUserStateFromRequest($this->context . '.filter.featured', 'filter_featured', '', 'string');
     $this->setState('filter.featured', $value);
     // Load filter category.
     $value = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id', 0, 'int');
     $this->setState('filter.category_id', $value);
     // Load filter type.
     $value = $this->getUserStateFromRequest($this->context . '.filter.type_id', 'filter_type_id', 0, 'int');
     $this->setState('filter.type_id', $value);
     // List state information.
     parent::populateState('a.created', 'asc');
 }
 function send()
 {
     if (!JSession::checkToken('request')) {
         // Check for a valid token. If invalid, send a 403 with the error message.
         JError::raiseWarning(403, JText::_('JINVALID_TOKEN'));
         echo version_compare(JPlatform::RELEASE, '12', 'ge') ? new JResponseJson() : new JJsonResponse();
         return;
     }
     $cid = JRequest::getVar('cid', array(0), null, 'array');
     $sid = JRequest::getVar('w_id', null, null, 'int');
     if (!$sid) {
         $sid = JRequest::getVar('j2xml_send_id', null, null, 'int');
     }
     if (!$sid) {
         JError::raiseWarning(1, JText::_('UNKNOWN_HOST'));
         echo version_compare(JPlatform::RELEASE, '12', 'ge') ? new JResponseJson() : new JJsonResponse();
         return;
     }
     $params = JComponentHelper::getParams('com_j2xml');
     $images = array();
     $xml = J2XMLExporter::categories($cid, $params->get('export_images', '1'), true, $params->get('export_users', '1'), $images);
     foreach ($images as $image) {
         $xml .= $image;
     }
     J2XMLSender::send($xml, $params->get('debug', 0), $params->get('export_gzip', '0'), $sid);
     echo version_compare(JPlatform::RELEASE, '12', 'ge') ? new JResponseJson() : new JJsonResponse();
 }
Example #14
0
 function getFeeds()
 {
     $app = JFactory::getApplication();
     $params = JComponentHelper::getParams('com_jce');
     $limit = $params->get('feed_limit', 2);
     $feeds = array();
     $options = array('rssUrl' => 'http://www.joomlacontenteditor.net/news/feed/rss/latest-news?format=feed', 'cache_time' => $params->get('feed_cachetime', 86400));
     // use this directly instead of JFactory::getXMLParserto avoid the feed data error
     jimport('simplepie.simplepie');
     if (!is_writable(JPATH_BASE . '/cache')) {
         $options['cache_time'] = 0;
     }
     $rss = new SimplePie($options['rssUrl'], JPATH_BASE . '/cache', isset($options['cache_time']) ? $options['cache_time'] : 0);
     $rss->force_feed(true);
     $rss->handle_content_type();
     if ($rss->init()) {
         $count = $rss->get_item_quantity();
         if ($count) {
             $count = $count > $limit ? $limit : $count;
             for ($i = 0; $i < $count; $i++) {
                 $feed = new StdClass();
                 $item = $rss->get_item($i);
                 $feed->link = $item->get_link();
                 $feed->title = $item->get_title();
                 $feed->description = $item->get_description();
                 $feeds[] = $feed;
             }
         }
     }
     return $feeds;
 }
Example #15
0
 public function postflight($action, $adapter)
 {
     $table = JTable::getInstance('extension');
     $component = "com_jevents";
     if (!$table->load(array("element" => "com_jevents", "type" => "component"))) {
         JFactory::getApplication()->enqueueMessage('Not a valid component', 'error');
         return false;
     }
     $params = JComponentHelper::getParams("com_jevents");
     $checkClashes = $params->get("checkclashes", 0);
     if ($params->get("noclashes", 0)) {
         $params->set("checkconflicts", "2");
     } else {
         if ($params->get("checkclashes", 0)) {
             $params->set("checkconflicts", "1");
         }
     }
     $paramsArray = $params->toArray();
     unset($paramsArray['checkclashes']);
     unset($paramsArray['noclashes']);
     $post['params'] = $paramsArray;
     $post['option'] = $component;
     $table->bind($post);
     // pre-save checks
     if (!$table->check()) {
         JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
         return false;
     }
     // save the changes
     if (!$table->store()) {
         JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
         return false;
     }
     return true;
 }
Example #16
0
 public function save()
 {
     $app = JFactory::getApplication();
     $model = $this->getModel('promotion');
     $row =& JTable::getInstance('Promotions', 'DJClassifiedsTable');
     $par =& JComponentHelper::getParams('com_djclassifieds');
     if (!$row->bind(JRequest::get('post'))) {
         echo "<script> alert('" . $row->getError() . "');\n\t\t\t\twindow.history.go(-1); </script>\n";
         exit;
     }
     if (!$row->store()) {
         echo "<script> alert('" . $row->getError() . "');\n\t\t\t\twindow.history.go(-1); </script>\n";
         exit;
     }
     switch (JRequest::getVar('task')) {
         case 'apply':
             $link = 'index.php?option=com_djclassifieds&task=promotion.edit&id=' . $row->id;
             $msg = JText::_('COM_DJCLASSIFIEDS_PROMOTION_SAVED');
             break;
         case 'save2new':
             $link = 'index.php?option=com_djclassifieds&task=promotion.add';
             $msg = JText::_('COM_DJCLASSIFIEDS_PROMOTION_SAVED');
             break;
         case 'saveItem':
         default:
             $link = 'index.php?option=com_djclassifieds&view=promotions';
             $msg = JText::_('COM_DJCLASSIFIEDS_PROMOTION_SAVED');
             break;
     }
     $app->redirect($link, $msg);
 }
Example #17
0
 /**
  * creates the lineitem object. $dblineitem is the database object of this line item
  *
  * @param string $foldername
  * @param string $filename
  */
 function __construct($foldername, $filename = null)
 {
     if (is_object($foldername)) {
         $this->_file = $foldername;
         $foldername = $this->_file->folder;
         $filename = $this->_file->file;
     }
     parent::__construct($foldername, $filename);
     $app = JFactory::getApplication();
     $params = null;
     if ($app instanceof JSite) {
         /**
          * @var JSite $app
          */
         $params = JComponentHelper::getParams('com_eventgallery');
     } else {
         $params = JComponentHelper::getParams('com_eventgallery');
     }
     if ($params->get('use_legacy_image_rendering', '0') == '1') {
         $this->_image_script_path = "index.php";
     }
     if (isset($this->_file->exif)) {
         $this->exif = json_decode($this->_file->exif);
     } else {
         $this->exif = new stdClass();
     }
 }
Example #18
0
 /**
  * Display
  *
  * @param   string  $tmpl  Template
  *
  * @return  void
  */
 public function display($tmpl = 'default')
 {
     $srcs = FabrikHelperHTML::framework();
     $app = JFactory::getApplication();
     $input = $app->input;
     FabrikHelperHTML::script($srcs);
     $model = $this->getModel();
     $usersConfig = JComponentHelper::getParams('com_fabrik');
     $model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0))));
     $visualization = $model->getVisualization();
     $pluginParams = $model->getPluginParams();
     $pluginManager = JModelLegacy::getInstance('Pluginmanager', 'FabrikModel');
     $plugin = $pluginManager->getPlugIn($visualization->plugin, 'visualization');
     $plugin->_row = $visualization;
     if ($visualization->published == 0) {
         return JError::raiseWarning(500, FText::_('COM_FABRIK_SORRY_THIS_VISUALIZATION_IS_UNPUBLISHED'));
     }
     // Plugin is basically a model
     $pluginTask = $input->get('plugintask', 'render', 'request');
     // @FIXME cant set params directly like this, but I think plugin model setParams() is not right
     $plugin->_params = $pluginParams;
     $tmpl = $plugin->getParams()->get('calendar_layout', $tmpl);
     $plugin->{$pluginTask}($this);
     $this->plugin = $plugin;
     $viewName = $this->getName();
     $this->addTemplatePath($this->_basePath . '/plugins/' . $this->_name . '/' . $plugin->_name . '/tmpl/' . $tmpl);
     $root = $app->isAdmin() ? JPATH_ADMINISTRATOR : JPATH_SITE;
     $this->addTemplatePath($root . '/templates/' . $app->getTemplate() . '/html/com_fabrik/visualization/' . $plugin->_name . '/' . $tmpl);
     $ab_css_file = JPATH_SITE . '/plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/template.css';
     if (JFile::exists($ab_css_file)) {
         JHTML::stylesheet('template.css', 'plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/', true);
     }
     echo parent::display();
 }
Example #19
0
 /**
  * Method to get the field options.
  *
  * @return	array	The field option objects.
  * @since	1.6
  */
 protected function getOptions()
 {
     $options = array();
     $params = JComponentHelper::getParams('com_joomdle');
     $app = $params->get('activities');
     $option = array('value' => 'no', 'text' => JText::_('COM_JOOMDLE_NONE'));
     $options[] = $option;
     $option = array('value' => 'jomsocial', 'text' => 'Jomsocial');
     $options[] = $option;
     // Add sources added via plugins
     JPluginHelper::importPlugin('joomdleactivities');
     $dispatcher = JDispatcher::getInstance();
     $more_sources = $dispatcher->trigger('onGetActivitiesSource', array());
     if (is_array($more_sources)) {
         foreach ($more_sources as $source) {
             $keys = array_keys($source);
             $key = $keys[0];
             $source_name = array_shift($source);
             $option['value'] = $key;
             $option['text'] = $source_name;
             $options[] = $option;
         }
     }
     return $options;
 }
Example #20
0
 static function GeoCode($address, $returnBox = false)
 {
     $params =& JComponentHelper::getParams('com_webmapplus');
     $key = $params->get('gmaps_api_key', '');
     $request = "http://maps.google.com/maps/geo?q=" . urlencode($address) . "&key={$key}";
     if (function_exists("curl_version")) {
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $request);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
         $page = curl_exec($ch);
         curl_close($ch);
     } elseif (ini_get('allow_url_fopen') == 1) {
         $page = file_get_contents($request);
     } else {
         echo "cURL is not installed and allow_url_fopen is false. Can not continue.";
         die;
         return false;
     }
     //Silly Google doesn't use UTF-8 Encoding
     $page = mb_convert_encoding($page, 'UTF-8', mb_detect_encoding($page, 'UTF-8, ISO-8859-1', true));
     $data = json_decode($page);
     if ($data->Status->code == "200") {
         if (!$returnBox) {
             return $data->Placemark[0]->Point->coordinates;
         } else {
             return $data->Placemark[0]->ExtendedData->LatLonBox;
         }
     } else {
         return $data->Status->code;
     }
 }
Example #21
0
 /**
  * Called after any type of action
  *
  * @param     string              $route      Which action is happening (install|uninstall|discover_install)
  * @param     jadapterinstance    $adapter    The object responsible for running this script
  *
  * @return    boolean                         True on success
  */
 public function postflight($route, JAdapterInstance $adapter)
 {
     if (strtolower($route) == 'install') {
         $element = $adapter->get('element');
         // Restore assets from backup
         PFInstallerHelper::restoreAssets($element);
         // Make the admin component menu item a child of com_projectfork
         PFInstallerHelper::setComponentMenuItem($element);
         // Create a menu item in the projectfork site menu
         $com = JComponentHelper::getComponent($element);
         $eid = is_object($com) && isset($com->id) ? $com->id : 0;
         if ($eid) {
             $item = array();
             $item['title'] = 'Time Tracking';
             $item['alias'] = 'timetracking';
             $item['link'] = 'index.php?option=' . $element . '&view=timesheet';
             $item['component_id'] = $eid;
             PFInstallerHelper::addMenuItem($item);
         }
     }
     if (strtolower($route) == 'update') {
         $element = $adapter->get('element');
         // Make the admin component menu item a child of com_projectfork
         PFInstallerHelper::setComponentMenuItem($element);
     }
     return true;
 }
Example #22
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $jinput = $app->input;
     $option = $jinput->getCmd('option');
     if ($this->getLayout() == 'form') {
         $this->_displayForm($tpl);
         return;
     }
     if ($this->getLayout() == 'info') {
         $this->_displayInfo($tpl);
         return;
     }
     if ($this->getLayout() == 'selectpage') {
         $this->_displaySelectpage($tpl);
         return;
     }
     // Set toolbar items for the page
     JToolBarHelper::title(JText::_('COM_JOOMLEAGUE_ADMIN_XML_IMPORT_TITLE_1_3'), 'generic.png');
     JToolBarHelper::help('screen.joomleague', true);
     $uri = JFactory::getURI();
     $config = JComponentHelper::getParams('com_media');
     $post = JRequest::get('post');
     $files = JRequest::get('files');
     $this->request_url = $uri->toString();
     $this->config = $config;
     parent::display($tpl);
 }
Example #23
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $params = JComponentHelper::getParams('com_tz_pinboard');
     $img_size = $params->get('portfolio_image_size');
     $this->assign('img_size', $img_size);
     if (JRequest::getCmd('task') != 'lists') {
         JFactory::getLanguage()->load('com_content');
         if ($this->getLayout() == 'pagebreak') {
             // TODO: This is really dogy - should change this one day.
             $eName = JRequest::getVar('e_name');
             $eName = preg_replace('#[^A-Z0-9\\-\\_\\[\\]]#i', '', $eName);
             $document = JFactory::getDocument();
             $document->setTitle(JText::_('COM_CONTENT_PAGEBREAK_DOC_TITLE'));
             $this->assignRef('eName', $eName);
             parent::display($tpl);
             return;
         }
         // Initialiase variables.
         $this->form = $this->get('Form');
         $this->item = $this->get('Item');
         $this->state = $this->get('State');
         $this->canDo = TZ_PinboardHelper::getActions($this->state->get('filter.category_id'));
         // Check for errors.
         if (count($errors = $this->get('Errors'))) {
             JError::raiseError(500, implode("\n", $errors));
             return false;
         }
         $this->assign('listsGroup', $this->get('FieldsGroup'));
         $this->assign('listsTags', $this->get('Tags'));
         $this->assign('listAttach', $this->get('Attachment'));
         $this->assign('listEdit', $this->get('FieldsContent'));
         $this->addToolbar();
     }
     parent::display($tpl);
 }
 function _displayForm($tpl)
 {
     $option = JRequest::getCmd('option');
     $mainframe = JFactory::getApplication();
     $uri = JFactory::getURI();
     $user = JFactory::getUser();
     $model = $this->getModel();
     //get the project
     $object =& $this->get('data');
     $isNew = $object->id < 1;
     // fail if checked out not by 'me'
     if ($model->isCheckedOut($user->get('id'))) {
         $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('COM_JOOMLEAGUE_ADMIN_LEAGUE'), $object->name);
         $mainframe->redirect('index.php?option=' . $option, $msg);
     }
     // Edit or Create?
     if (!$isNew) {
         $model->checkout($user->get('id'));
     } else {
         // initialise new record
         $object->order = 0;
     }
     $extended = $this->getExtended($object->extended, 'league');
     $this->assignRef('extended', $extended);
     $this->assignRef('object', $object);
     $this->assignRef('form', $this->get('form'));
     $this->assign('cfg_which_media_tool', JComponentHelper::getParams($option)->get('cfg_which_media_tool', 0));
     $this->addToolbar();
     parent::display($tpl);
 }
Example #25
0
 function display($tmpl = 'default')
 {
     require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'html.php';
     $model = $this->getModel();
     $usersConfig = JComponentHelper::getParams('com_fabrik');
     $id = JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)));
     $model->setId($id);
     $this->assign('id', $id);
     $this->assignRef('row', $this->get('Visualization'));
     $this->assign('rows', $this->get('Rows'));
     $this->assign('containerId', $this->get('ContainerId'));
     $this->calName = $this->get('VizName');
     $this->assignRef('params', $this->get('PluginParams'));
     $tmpl = $this->params->get('approvals_layout', $tmpl);
     $tmplpath = JPATH_SITE . DS . 'plugins' . DS . 'fabrik_visualization' . DS . 'approvals' . DS . 'views' . DS . 'approvals' . DS . 'tmpl' . DS . $tmpl;
     $this->_setPath('template', $tmplpath);
     $ab_css_file = $tmplpath . DS . "template.css";
     if (file_exists($ab_css_file)) {
         JHTML::stylesheet('/plugins/fabrik_visualization/approvals/views/approvals/tmpl/' . $tmpl . '/template.css');
     }
     FabrikHelperHTML::script('plugins/fabrik_visualization/approvals/approvals.js', true, "var approvals = new fbVisApprovals('approvals_" . $id . "');");
     $text = $this->loadTemplate();
     $opt = JRequest::getVar('option');
     $view = JRequest::getCmd('view');
     JRequest::setVar('view', 'article');
     JRequest::setVar('option', 'com_content');
     jimport('joomla.html.html.content');
     $text .= '{emailcloak=off}';
     $text = JHTML::_('content.prepare', $text);
     $text = preg_replace('/\\{emailcloak\\=off\\}/', '', $text);
     JRequest::setVar('option', $opt);
     echo $text;
 }
Example #26
0
function DefaultRedirectDetail($view)
{
    $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
    $redirect_to_event = $params->get("redirect_detail", 0);
    if ($redirect_to_event == 1) {
        $activeEvents = array();
        $countevents = count($view->data['hours']['timeless']['events']);
        if ($countevents > 1) {
            return;
        }
        if ($countevents == 1) {
            $activeEvents = $view->data['hours']['timeless']['events'];
        }
        for ($h = 0; $h < 24; $h++) {
            $countevents += count($view->data['hours'][$h]['events']);
            if ($countevents > 1) {
                return;
            }
            if ($countevents == 1 && count($activeEvents) == 0) {
                $activeEvents = $view->data['hours'][$h]['events'];
            }
        }
        if ($countevents == 1) {
            $row = $activeEvents[0];
            $rowlink = $row->viewDetailLink($row->yup(), $row->mup(), $row->dup(), false);
            $rowlink = JRoute::_($rowlink . $view->datamodel->getCatidsOutLink());
            $rowlink = str_replace("&", "&", $rowlink);
            JFactory::getApplication()->redirect($rowlink);
        }
    }
}
Example #27
0
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication('administrator');
     // Adjust the context to support modal layouts.
     if ($layout = $app->input->get('layout', 'default', 'cmd')) {
         $this->context .= '.' . $layout;
     }
     // Load the filter state.
     $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $search);
     $active = $this->getUserStateFromRequest($this->context . '.filter.active', 'filter_active');
     $this->setState('filter.active', $active);
     $state = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state');
     $this->setState('filter.state', $state);
     $groupId = $this->getUserStateFromRequest($this->context . '.filter.group', 'filter_group_id', null, 'int');
     $this->setState('filter.group_id', $groupId);
     $range = $this->getUserStateFromRequest($this->context . '.filter.range', 'filter_range');
     $this->setState('filter.range', $range);
     $groups = json_decode(base64_decode($app->input->get('groups', '', 'BASE64')));
     if (isset($groups)) {
         JArrayHelper::toInteger($groups);
     }
     $this->setState('filter.groups', $groups);
     $excluded = json_decode(base64_decode($app->input->get('excluded', '', 'BASE64')));
     if (isset($excluded)) {
         JArrayHelper::toInteger($excluded);
     }
     $this->setState('filter.excluded', $excluded);
     // Load the parameters.
     $params = JComponentHelper::getParams('com_users');
     $this->setState('params', $params);
     // List state information.
     parent::populateState('a.name', 'asc');
 }
Example #28
0
	/**
	 * Method to auto-populate the model state.
	 *
	 * Note. Calling getState in this method will result in recursion.
	 *
	 * @param   string  $ordering   An optional ordering field.
	 * @param   string  $direction  An optional direction (asc|desc).
	 *
	 * @return    void
	 * @since    3.1
	 */
	protected function populateState($ordering = null, $direction = null)
	{
		$app = JFactory::getApplication();
		$context = $this->context;

		$search = $this->getUserStateFromRequest($context . '.search', 'filter_search');
		$this->setState('filter.search', $search);

		$level = $this->getUserStateFromRequest($context . '.filter.level', 'filter_level', 0, 'int');
		$this->setState('filter.level', $level);

		$access = $this->getUserStateFromRequest($context . '.filter.access', 'filter_access', 0, 'int');
		$this->setState('filter.access', $access);

		$published = $this->getUserStateFromRequest($context . '.filter.published', 'filter_published', '');
		$this->setState('filter.published', $published);

		$language = $this->getUserStateFromRequest($context . '.filter.language', 'filter_language', '');
		$this->setState('filter.language', $language);

		// Load the parameters.
		$params = JComponentHelper::getParams('com_tags');
		$this->setState('params', $params);

		// List state information.
		parent::populateState('a.lft', 'asc');
	}
 function plgAcymailingContentplugin(&$subject, $config)
 {
     parent::__construct($subject, $config);
     if (!isset($this->params)) {
         $plugin = JPluginHelper::getPlugin('acymailing', 'contentplugin');
         $this->params = new acyParameter($plugin->params);
     }
     $this->paramsContent = JComponentHelper::getParams('com_content');
     JPluginHelper::importPlugin('content');
     $this->dispatcherContent = JDispatcher::getInstance();
     $excludedHandlers = array('plgContentEmailCloak', 'pluginImageShow');
     $excludedNames = array('system' => array('SEOGenerator', 'SEOSimple'), 'content' => array('webeecomment', 'highslide', 'smartresizer', 'phocagallery'));
     $excludedType = array_keys($excludedNames);
     if (!ACYMAILING_J16) {
         foreach ($this->dispatcherContent->_observers as $id => $observer) {
             if (is_array($observer) and in_array($observer['handler'], $excludedHandlers)) {
                 $this->dispatcherContent->_observers[$id]['event'] = '';
             } elseif (is_object($observer)) {
                 if (in_array($observer->_type, $excludedType) and in_array($observer->_name, $excludedNames[$observer->_type])) {
                     $this->dispatcherContent->_observers[$id] = null;
                 }
             }
         }
     }
     if (!class_exists('JSite')) {
         include_once ACYMAILING_ROOT . 'includes' . DS . 'application.php';
     }
 }
Example #30
0
 /**
  * onAfterInitialise handler
  *
  *
  * @access	public
  * @return null
  */
 public function onAfterInitialise()
 {
     // make sure ZOO exists
     jimport('joomla.filesystem.file');
     if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php') || !JComponentHelper::getComponent('com_zoo', true)->enabled) {
         return;
     }
     // load zoo
     require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php';
     // check if Zoo > 2.4 is loaded
     if (!class_exists('App')) {
         return;
     }
     // get zoo instance
     $this->zoo = App::getInstance('zoo');
     // check if Zoo > 2.5
     if (version_compare($this->zoo->zoo->version(), '2.5') < 0) {
         return;
     }
     // load zoo language file
     $this->zoo->system->language->load('com_' . $this->zoo->id);
     // register plugin paths
     $path = $this->zoo->path->path('plugins:system/herdboyzoo/');
     // register element path
     $this->zoo->path->register($path . '/elements', 'elements');
 }