Example #1
0
	public function display($tpl = null)
	{
		$user 		= JemFactory::getUser();
		$document	= JFactory::getDocument();
		$url 		= JUri::root();
		$settings 	= JEMHelper::globalattribs();

		// Initialise variables.
		$this->items		= $this->get('Items');
		$this->pagination	= $this->get('Pagination');
		$this->state		= $this->get('State');
		$this->settings		= $settings;

		$params = $this->state->get('params');

		// highlighter
		$highlighter = $settings->get('highlight','0');

		// Check for errors.
		if (count($errors = $this->get('Errors'))) {
			JError::raiseError(500, implode("\n", $errors));
			return false;
		}

		// Load css
		JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);

		// Add Scripts
		$document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js');

		if ($highlighter) {
			$document->addScript($url.'media/com_jem/js/highlighter.js');
			$style = '
			    .red, .red a {
			        color:red;}
			    ';
			$document->addStyleDeclaration($style);
		}

		//add style to description of the tooltip (hastip)
		JHtml::_('behavior.tooltip');

		// add filter selection for the search
		$filters = array();
		$filters[] = JHtml::_('select.option', '1', JText::_('COM_JEM_VENUE'));
		$filters[] = JHtml::_('select.option', '2', JText::_('COM_JEM_CITY'));
		$filters[] = JHtml::_('select.option', '3', JText::_('COM_JEM_STATE'));
		$filters[] = JHtml::_('select.option', '4', JText::_('COM_JEM_COUNTRY'));
		$filters[] = JHtml::_('select.option', '5', JText::_('JALL'));
		$lists['filter'] = JHtml::_('select.genericlist', $filters, 'filter_type', array('size'=>'1','class'=>'inputbox'), 'value', 'text', $this->state->get('filter_type'));

		//assign data to template
		$this->lists = $lists;
		$this->user  = $user;

		// add toolbar
		$this->addToolbar();

		parent::display($tpl);
	}
 public function getInput()
 {
     $starthours = JEMHelper::buildtimeselect(23, 'starthours', substr($this->value, 0, 2));
     $startminutes = JEMHelper::buildtimeselect(59, 'startminutes', substr($this->value, 3, 2));
     $var2 = $starthours . "</div><div class='col-sm-4 col-xs-6'>" . $startminutes;
     return $var2;
 }
Example #3
0
	/**
	 * Constructor
	 *
	 */
	public function __construct()
	{
		parent::__construct();

		$app = JFactory::getApplication();
		$jemsettings = JEMHelper::config();

		//get the number of events from database
		$limit		= $app->getUserStateFromRequest('com_jem.search.limit', 'limit', $jemsettings->display_num, 'int');
		$limitstart	= $app->input->getInt('limitstart', 0);
		// correct start value if required
		$limitstart = $limit ? (int)(floor($limitstart / $limit) * $limit) : 0;

		$this->setState('limit', $limit);
		$this->setState('limitstart', $limitstart);

		// Get the filter request variables
		$filter_order = $app->input->getCmd('filter_order', 'a.dates');
		$this->setState('filter_order', $filter_order);

		$filter_order_DirDefault = 'ASC';
		// Reverse default order for dates in archive mode
		$task = $app->input->get('task', '');
		if (($task == 'archive') && ($filter_order == 'a.dates')) {
			$filter_order_DirDefault = 'DESC';
		}
		$this->setState('filter_order_Dir', $app->input->getCmd('filter_order_Dir', $filter_order_DirDefault));
	}
Example #4
0
 public function display($tpl = null)
 {
     // Initialise variables.
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     JHtml::_('behavior.framework');
     // initialise variables
     $jemsettings = JEMHelper::config();
     $document = JFactory::getDocument();
     $this->settings = JEMAdmin::config();
     $task = JFactory::getApplication()->input->get('task');
     $this->task = $task;
     $url = JUri::root();
     // Load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
     // JQuery noConflict
     $document->addCustomTag('<script type="text/javascript">jQuery.noConflict();</script>');
     $document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js');
     $document->addScript('http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js');
     $this->jemsettings = $jemsettings;
     $this->addToolbar();
     parent::display($tpl);
 }
Example #5
0
	/**
	 * Constructor
	 *
	 */
	public function __construct()
	{
		parent::__construct();

		$app         = JFactory::getApplication();
		$jemsettings = JEMHelper::config();
		$settings    = JEMHelper::globalattribs();

		$id = $app->input->getInt('id', 0);
		$this->setId((int)$id);

		$this->_reguser = $settings->get('global_regname', '1');

		/* in J! 3.3.6 limitstart is removed from request - but we need it! */
		if ($app->input->getInt('limitstart', null) === null) {
			$app->setUserState('com_jem.attendees.limitstart', 0);
		}

		$limit		= $app->getUserStateFromRequest( 'com_jem.attendees.limit', 'limit', $jemsettings->display_num, 'int');
		$limitstart = $app->getUserStateFromRequest( 'com_jem.attendees.limitstart', 'limitstart', 0, 'int' );
		// correct start value if required
		$limitstart = $limit ? (int)(floor($limitstart / $limit) * $limit) : 0;

		$this->setState('limit', $limit);
		$this->setState('limitstart', $limitstart);

		//set unlimited if export or print action | task=export or task=print
		$task = $app->input->get('task', '');
		$this->setState('unlimited', ($task == 'export' || $task == 'print') ? '1' : '');
	}
Example #6
0
 public function display($tpl = null)
 {
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $settings = JEMHelper::globalattribs();
     $jemsettings = JEMAdmin::config();
     $url = JUri::root();
     // Initialise variables.
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     // Retrieving params
     $params = $this->state->get('params');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // loading Mootools
     JHtml::_('behavior.framework');
     // Load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
     // Load Scripts
     $document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js');
     $document->addCustomTag('<script type="text/javascript">jQuery.noConflict();</script>');
     // assign data to template
     $this->user = $user;
     $this->jemsettings = $jemsettings;
     $this->settings = $settings;
     // add toolbar
     $this->addToolbar();
     parent::display($tpl);
 }
Example #7
0
 public function getInput()
 {
     $endhours = JEMHelper::buildtimeselect(23, 'endhours', substr($this->value, 0, 2));
     $endminutes = JEMHelper::buildtimeselect(59, 'endminutes', substr($this->value, 3, 2));
     $var2 = $endhours . $endminutes;
     return $var2;
 }
Example #8
0
 public function display($tpl = null)
 {
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $jemsettings = JEMHelper::config();
     $document = JFactory::getDocument();
     $this->settings = JEMAdmin::config();
     $task = JFactory::getApplication()->input->get('task');
     $this->task = $task;
     $url = JUri::root();
     // Load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
     $maintainers = $this->get('Members');
     $available_users = $this->get('Available');
     //make data safe
     JFilterOutput::objectHTMLSafe($this->item);
     //create selectlists
     $lists = array();
     $lists['maintainers'] = JHtml::_('select.genericlist', $maintainers, 'maintainers[]', array('class' => 'inputbox', 'size' => '20', 'onDblClick' => 'moveOptions(document.adminForm[\'maintainers[]\'], document.adminForm[\'available_users\'])', 'multiple' => 'multiple', 'style' => 'padding: 6px; width: 250px;'), 'value', 'text');
     $lists['available_users'] = JHtml::_('select.genericlist', $available_users, 'available_users', array('class' => 'inputbox', 'size' => '20', 'onDblClick' => 'moveOptions(document.adminForm[\'available_users\'], document.adminForm[\'maintainers[]\'])', 'multiple' => 'multiple', 'style' => 'padding: 6px; width: 250px;'), 'value', 'text');
     $this->jemsettings = $jemsettings;
     $this->lists = $lists;
     $this->addToolbar();
     parent::display($tpl);
 }
Example #9
0
 public function display($tpl = null)
 {
     $user = JFactory::getUser();
     $document = JFactory::getDocument();
     $url = JUri::root();
     $settings = JEMHelper::globalattribs();
     // Initialise variables.
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
     $this->settings = $settings;
     $params = $this->state->get('params');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // Load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
     $this->user = $user;
     # add toolbar
     $this->addToolbar();
     parent::display($tpl);
 }
Example #10
0
	/**
	 * Constructor
	 *
	 *
	 */
	public function __construct()
	{
		parent::__construct();

		$settings = JEMHelper::globalattribs();
		$this->regname = $settings->get('global_regname','1');

		$array = JFactory::getApplication()->input->get('cid', array(), 'array');
		$this->setId((int)$array[0]);
	}
Example #11
0
	/**
	 * Method to get venue data.
	 *
	 * @param integer	The id of the venue.
	 * @return mixed item data object on success, false on failure.
	 */
	public function getItem($itemId = null)
	{
		$jemsettings = JEMHelper::config();

		// Initialise variables.
		$itemId = (int) (!empty($itemId)) ? $itemId : $this->getState('venue.id');

		// Get a row instance.
		$table = $this->getTable();

		// Attempt to load the row.
		$return = $table->load($itemId);

		// Check for a table object error.
		if ($return === false && $table->getError()) {
			$this->setError($table->getError());
			return false;
		}

		$properties = $table->getProperties(1);
		$value = JArrayHelper::toObject($properties, 'JObject');

		// Convert attrib field to Registry.
		//$registry = new JRegistry();
		//$registry->loadString($value->attribs);

		$globalregistry = JemHelper::globalattribs();

		$value->params = clone $globalregistry;
		//$value->params->merge($registry);

		// Compute selected asset permissions.
		$user = JemFactory::getUser();

		// Check edit permission.
		$value->params->set('access-edit', $user->can('edit', 'venue', $value->id, $value->created_by));

		// Check edit state permission.
		$value->params->set('access-change', $user->can('publish', 'venue', $value->id, $value->created_by));

		$value->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false;

		$files = JemAttachment::getAttachments('venue' . $itemId);
		$value->attachments = $files;

		if (empty($itemId)) {
			$value->country = $jemsettings->defaultCountry;
		}

		return $value;
	}
Example #12
0
	public function display($tpl = null)
	{
		// Initialise variables.
		$this->form	 = $this->get('Form');
		$this->item	 = $this->get('Item');
		$this->state = $this->get('State');

		// Check for errors.
		if (count($errors = $this->get('Errors'))) {
			JError::raiseError(500, implode("\n", $errors));
			return false;
		}

		JHtml::_('behavior.framework');
		JHtml::_('behavior.modal', 'a.modal');
		JHtml::_('behavior.tooltip');
		JHtml::_('behavior.formvalidation');

		//initialise variables
		$document       = JFactory::getDocument();
		$this->settings = JEMAdmin::config();
		$task           = JFactory::getApplication()->input->get('task', '');
		$this->task     = $task;

		// Load css
		JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
		JHtml::_('stylesheet', 'com_jem/geostyle.css', array(), true);

		// Load Scripts
		JHtml::_('script', 'com_jem/attachments.js', false, true);
		//$document->addScript('http://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places');

		$language = JFactory::getLanguage();
		$language = $language->getTag();
		$language = substr($language, 0,2);

		$document->addScript('http://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places&language='.$language);

		// Noconflict
		$document->addCustomTag('<script type="text/javascript">jQuery.noConflict();</script>');

		// JQuery scripts
		$document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js');
		JHtml::_('script', 'com_jem/jquery.geocomplete.js', false, true);

		$access2 = JEMHelper::getAccesslevelOptions();
		$this->access		= $access2;

		$this->addToolbar();
		parent::display($tpl);
	}
 /**
  * Constructor
  */
 public function __construct()
 {
     $app = JFactory::getApplication();
     $jemsettings = JEMHelper::config();
     $itemid = $app->input->getInt('id', 0) . ':' . $app->input->getInt('Itemid', 0);
     // Get the parameters of the active menu item
     $params = $app->getParams();
     $id = $app->input->getInt('id', 0);
     if (empty($id)) {
         $id = $params->get('id', 1);
     }
     $this->setId((int) $id);
     parent::__construct();
 }
Example #14
0
 public function display($tpl = null)
 {
     // Initialise variables.
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // initialise variables
     $document = JFactory::getDocument();
     $app = JFactory::getApplication();
     $jinput = $app->input;
     $this->settings = JEMAdmin::config();
     $this->settings2 = JemHelper::globalattribs();
     $task = $jinput->getCmd('task');
     $this->task = $task;
     # load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
     # load js
     //JHtml::_('behavior.framework'); //mootools
     JHtml::_('script', 'com_jem/attachments.js', false, true);
     //$document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js');
     $this->access = JEMHelper::getAccesslevelOptions();
     # retrieve mapType setting
     $settings = JemHelper::globalattribs();
     $mapType = $settings->get('mapType', '0');
     switch ($mapType) {
         case '0':
             $type = '"roadmap"';
             break;
         case '1':
             $type = '"satellite"';
             break;
         case '2':
             $type = '"hybrid"';
             break;
         case '3':
             $type = '"terrain"';
             break;
     }
     $this->mapType = $type;
     //JHtml::_('jquery.framework');
     JHtml::_('script', 'com_jem/slider-state.js', false, true);
     $this->addToolbar();
     parent::display($tpl);
 }
Example #15
0
 /**
  * Prepares the print screen
  *
  * @param $tpl
  *
  *
  */
 protected function _displayprint($tpl = null)
 {
     // Load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
     $this->items = $this->get('Items');
     $event = $this->get('Event');
     if (JEMHelper::isValidDate($event->dates)) {
         $event->dates = JEMOutput::formatdate($event->dates);
     } else {
         $event->dates = JText::_('COM_JEM_OPEN_DATE');
     }
     // assign data to template
     $this->event = $event;
     parent::display($tpl);
 }
Example #16
0
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct();
     $app = JFactory::getApplication();
     $jinput = JFactory::getApplication()->input;
     $jemsettings = JEMHelper::config();
     $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
     $id = $jinput->getInt('id');
     $this->setId($id);
     $limit = $app->getUserStateFromRequest('com_jem.attendees.' . $itemid . '.limit', 'limit', $jemsettings->display_num, 'uint');
     $limitstart = $app->input->get('limitstart', 0, 'uint');
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
     //set unlimited if export or print action | task=export or task=print
     $this->setState('unlimited', $jinput->getCmd('task'));
 }
Example #17
0
	/**
	 * Constructor
	 */
	public function __construct()
	{
		$app         = JFactory::getApplication();
		$jemsettings = JEMHelper::config();
		$jinput      = $app->input;
		$params      = $app->getParams();

		$id = $jinput->getInt('id', 0);
		if (empty($id)) {
			$id = $params->get('id', 0);
		}

		$this->setdate(time());
		$this->setId((int)$id);

		parent::__construct();
	}
Example #18
0
 /**
  * Constructor
  */
 public function __construct()
 {
     if (empty($config['filter_fields'])) {
         $config['filter_fields'] = array('id', 'a.id', 'title', 'a.title', 'dates', 'a.dates', 'times', 'a.times', 'alias', 'a.alias', 'venue', 'l.venue', 'venue_title', 'city', 'l.city', 'venue_city');
     }
     $app = JFactory::getApplication();
     $jinput = JFactory::getApplication()->input;
     $jemsettings = JEMHelper::config();
     $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
     // Get the parameters of the active menu item
     $params = $app->getParams();
     if ($jinput->getInt('id')) {
         $id = $jinput->getInt('id');
     } else {
         $id = $params->get('id', 1);
     }
     $this->setId((int) $id);
     parent::__construct();
 }
Example #19
0
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     parent::__construct();
     $app = JFactory::getApplication();
     $jinput = $app->input;
     $jemsettings = JEMHelper::config();
     $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
     //get the number of events from database
     $limit = $app->getUserStateFromRequest('com_jem.search.' . $itemid . '.limit', 'limit', $jemsettings->display_num, 'uint');
     $limitstart = $app->input->get('limitstart', 0, 'uint');
     $this->setState('limit', $limit);
     $this->setState('limitstart', $limitstart);
     // Get the filter request variables
     $filter_order = $jinput->getCmd('filter_order', 'a.dates');
     $this->setState('filter_order', $filter_order);
     $filter_order_DirDefault = 'ASC';
     // Reverse default order for dates in archive mode
     $task = $jinput->getCmd('task');
     if ($task == 'archive' && $filter_order == 'a.dates') {
         $filter_order_DirDefault = 'DESC';
     }
     $this->setState('filter_order_Dir', $jinput->getCmd('filter_order_Dir', $filter_order_DirDefault));
 }
Example #20
0
	/**
	 * Copies the Eventlist (v1.1) attachments to JEM folder
	 */
	public function copyAttachments()
	{
		jimport('joomla.filesystem.file');
		jimport('joomla.filesystem.folder');

		$jemsettings = JEMHelper::config();

		$fromFolder = JPATH_SITE.'/media/com_eventlist/attachments/';
		$toFolder   = JPATH_SITE.'/'.$jemsettings->attachments_path.'/';

		if (!JFolder::exists($toFolder)) {
			JFolder::create($toFolder);
		}

		if (JFolder::exists($fromFolder) && JFolder::exists($toFolder)) {
			$files = JFolder::files($fromFolder, null, false, false);
			foreach ($files as $file) {
				if (!JFile::exists($toFolder.$file)) {
					JFile::copy($fromFolder.$file, $toFolder.$file);
				}
			}

			// attachments are stored in folders like "event123"
			// so we need to walk through all these subfolders
			$folders = JFolder::folders($fromFolder, null, false, false);
			foreach ($folders as $folder) {
				if (!JFolder::exists($toFolder.$folder)) {
					JFolder::create($toFolder.$folder);
				}

				$files = JFolder::files($fromFolder.$folder, null, false, false);
				$folder .= '/';
				foreach ($files as $file) {
					if (!JFile::exists($toFolder.$folder.$file)) {
						JFile::copy($fromFolder.$folder.$file, $toFolder.$folder.$file);
					}
				}
			}
		}
	}
Example #21
0
 /**
  * Build the where clause
  *
  * @access private
  * @return string
  */
 protected function _buildVenuesWhere()
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $settings = JEMHelper::globalattribs();
     $user = JFactory::getUser();
     $jinput = JFactory::getApplication()->input;
     $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
     $filter_type = $app->getUserStateFromRequest('com_jem.myvenues.' . $itemid . '.filter_type', 'filter_type', '', 'int');
     $search = $app->getUserStateFromRequest('com_jem.myvenues.' . $itemid . '.filter_search', 'filter_search', '', 'string');
     $search = $this->_db->escape(trim(JString::strtolower($search)));
     $where = array();
     $where[] = ' l.published IN (0,1,2,-2)';
     // check if venue is created by the user
     $where[] = ' l.created_by = ' . $this->_db->Quote($user->id);
     if ($settings->get('global_show_filter') && $search) {
         switch ($filter_type) {
             case 1:
                 // 					$where[] = ' LOWER(a.title) LIKE \'%'.$search.'%\' ';
                 break;
             case 2:
                 $where[] = ' LOWER(l.venue) LIKE \'%' . $search . '%\' ';
                 break;
             case 3:
                 $where[] = ' LOWER(l.city) LIKE \'%' . $search . '%\' ';
                 break;
             case 4:
                 // 					$where[] = ' LOWER(c.catname) LIKE \'%'.$search.'%\' ';
                 break;
             case 5:
             default:
                 $where[] = ' LOWER(l.state) LIKE \'%' . $search . '%\' ';
         }
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     return $where;
 }
Example #22
0
	/**
	 * Creates the Venue View
	 */
	function display($tpl = null)
	{
		if ($this->getLayout() == 'calendar')
		{
			### Venue Calendar view ###

			$app = JFactory::getApplication();

			// Load tooltips behavior
			JHtml::_('behavior.tooltip');

			// initialize variables
			$document 		= JFactory::getDocument();
			$menu 			= $app->getMenu();
			$menuitem		= $menu->getActive();
			$jemsettings	= JEMHelper::config();
			$params 		= $app->getParams();
			$uri 			= JFactory::getURI();
			$pathway 		= $app->getPathWay();
			$jinput 		= $app->input;
			$print			= $jinput->getBool('print', false);
			$user			= JemFactory::getUser();

			// Load css
			JemHelper::loadCss('jem');
			JemHelper::loadCss('calendar');
			JemHelper::loadCustomCss();
			JemHelper::loadCustomTag();

			if ($print) {
				JemHelper::loadCss('print');
				$document->setMetaData('robots', 'noindex, nofollow');
			}

			$evlinkcolor = $params->get('eventlinkcolor');
			$evbackgroundcolor = $params->get('eventbackgroundcolor');
			$currentdaycolor = $params->get('currentdaycolor');
			$eventandmorecolor = $params->get('eventandmorecolor');

			$style = '
			div#jem .eventcontentinner a, div#jem .eventandmore a {color:' . $evlinkcolor . ';}
			.eventcontentinner {background-color:'.$evbackgroundcolor .';}
			.eventandmore {background-color:' . $eventandmorecolor . ';}
			.today .daynum {background-color:' . $currentdaycolor . ';}';
			$document->addStyleDeclaration ($style);

			// add javascript (using full path - see issue #590)
			JHtml::_('script', 'media/com_jem/js/calendar.js');

			// Retrieve year/month variables
			$year = $jinput->get('yearID', strftime("%Y"),'int');
			$month = $jinput->get('monthID', strftime("%m"),'int');

			// get data from model and set the month
			$model = $this->getModel('VenueCal');
			$model->setDate(mktime(0, 0, 1, $month, 1, $year));
			$rows = $this->get('Items','VenueCal');

			// Set Page title
			$pagetitle = $params->def('page_title', $menuitem->title);
			$params->def('page_heading', $params->get('page_title'));
			$pageclass_sfx = $params->get('pageclass_sfx');

			// Add site name to title if param is set
			if ($app->getCfg('sitename_pagetitles', 0) == 1) {
				$pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle);
			}
			elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
				$pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename'));
			}

			$document->setTitle($pagetitle);
			$document->setMetaData('title', $pagetitle);

			// Check if the user has permission to add things
			$permissions = new stdClass();
			$permissions->canAddEvent = $user->can('add', 'event');
			$permissions->canAddVenue = $user->can('add', 'venue');

			$itemid  = $jinput->getInt('Itemid', 0);
			$venueID = $jinput->getInt('id', $params->get('id'));

			$partItemid = ($itemid > 0) ? '&Itemid=' . $itemid : '';
			$partVenid = ($venueID > 0) ? '&id=' . $venueID : '';
			$partLocid = ($venueID > 0) ? '&locid=' . $venueID : '';
			$partDate = ($year ? ('&yearID=' . $year) : '') . ($month ? ('&monthID=' . $month) : '');
			$url_base = 'index.php?option=com_jem&view=venue&layout=calendar' . $partVenid . $partItemid;

			$print_link = JRoute::_($url_base . $partDate . '&print=1&tmpl=component');

			// init calendar
			$cal = new JEMCalendar($year, $month, 0);
			$cal->enableMonthNav($url_base . ($print ? '&print=1&tmpl=component' : ''));
			$cal->setFirstWeekDay($params->get('firstweekday',1));
			$cal->enableDayLinks('index.php?option=com_jem&view=day'.$partLocid);

			// map variables
			$this->rows          = $rows;
			$this->locid         = $venueID;
			$this->params        = $params;
			$this->jemsettings   = $jemsettings;
			$this->permissions   = $permissions;
			$this->cal           = $cal;
			$this->pageclass_sfx = htmlspecialchars($pageclass_sfx);
			$this->print_link    = $print_link;

		} else
		{
			### Venue List view ###

			// initialize variables
			$app         = JFactory::getApplication();
			$document    = JFactory::getDocument();
			$menu        = $app->getMenu();
			$menuitem    = $menu->getActive();
			$jemsettings = JemHelper::config();
			$settings    = JemHelper::globalattribs();
			$params      = $app->getParams('com_jem');
			$pathway     = $app->getPathWay ();
			$uri         = JFactory::getURI();
			$jinput      = $app->input;
			$task        = $jinput->getCmd('task', '');
			$print       = $jinput->getBool('print', false);
			$user        = JemFactory::getUser();
			$itemid      = $app->input->getInt('id', 0) . ':' . $app->input->getInt('Itemid', 0);

			// Load css
			JemHelper::loadCss('jem');
			JemHelper::loadCustomCss();
			JemHelper::loadCustomTag();

			if ($print) {
				JemHelper::loadCss('print');
				$document->setMetaData('robots', 'noindex, nofollow');
			}

			// get data from model
			$rows	= $this->get('Items');
			$venue	= $this->get('Venue');

			// check for data error
			if (empty($venue)) {
				$app->enqueueMessage(JText::_('COM_JEM_VENUE_ERROR_VENUE_NOT_FOUND'), 'error');
				return false;
			}

			// are events available?
			$noevents = (!$rows) ? 1 : 0;

			// Decide which parameters should take priority
			$useMenuItemParams = ($menuitem && $menuitem->query['option'] == 'com_jem'
			                                && $menuitem->query['view']   == 'venue'
			                                && (!isset($menuitem->query['layout']) || $menuitem->query['layout'] == 'default')
			                                && $menuitem->query['id']     == $venue->id);

			// get search & user-state variables
			$filter_order = $app->getUserStateFromRequest('com_jem.venue.'.$itemid.'.filter_order', 'filter_order', 'a.dates', 'cmd');
			$filter_order_DirDefault = 'ASC';
			// Reverse default order for dates in archive mode
			if($task == 'archive' && $filter_order == 'a.dates') {
				$filter_order_DirDefault = 'DESC';
			}
			$filter_order_Dir = $app->getUserStateFromRequest('com_jem.venue.'.$itemid.'.filter_order_Dir', 'filter_order_Dir', $filter_order_DirDefault, 'word');
			$filter_type      = $app->getUserStateFromRequest('com_jem.venue.'.$itemid.'.filter_type', 'filter_type', '', 'int');
			$search           = $app->getUserStateFromRequest('com_jem.venue.'.$itemid.'.filter_search', 'filter_search', '', 'string');

			// table ordering
			$lists['order_Dir'] = $filter_order_Dir;
			$lists['order']     = $filter_order;

			// Get image
			$limage = JemImage::flyercreator($venue->locimage,'venue');

			// Add feed links
			$link = '&format=feed&id='.$venue->id.'&limitstart=';
			$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
			$this->document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
			$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
			$this->document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);

			// pathway, page title, page heading
			if ($useMenuItemParams) {
				$pagetitle   = $params->get('page_title', $menuitem->title ? $menuitem->title : $venue->venue);
				$pageheading = $params->get('page_heading', $pagetitle);
				$pathway->setItemName(1, $menuitem->title);
			} else {
				$pagetitle   = $venue->venue;
				$pageheading = $pagetitle;
				$params->set('show_page_heading', 1); // ensure page heading is shown
				$pathway->addItem($pagetitle, JRoute::_(JemHelperRoute::getVenueRoute($venue->slug)));
			}
			$pageclass_sfx = $params->get('pageclass_sfx');

			// create the pathway
			if ($task == 'archive') {
				$pathway->addItem (JText::_('COM_JEM_ARCHIVE'), JRoute::_(JemHelperRoute::getVenueRoute($venue->slug).'&task=archive'));
				$print_link = JRoute::_(JEMHelperRoute::getVenueRoute($venue->slug).'&task=archive&print=1&tmpl=component');
				$pagetitle   .= ' - ' . JText::_('COM_JEM_ARCHIVE');
				$pageheading .= ' - ' . JText::_('COM_JEM_ARCHIVE');
			} else {
				//$pathway->addItem($venue->venue, JRoute::_(JEMHelperRoute::getVenueRoute($venue->slug)));
				$print_link = JRoute::_(JemHelperRoute::getVenueRoute($venue->slug).'&print=1&tmpl=component');
			}

			$params->set('page_heading', $pageheading);

			// Add site name to title if param is set
			if ($app->getCfg('sitename_pagetitles', 0) == 1) {
				$pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle);
			}
			elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
				$pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename'));
			}

			// set Page title & Meta data
			$document->setTitle($pagetitle);
			$document->setMetaData('title', $pagetitle);
			$document->setMetadata('keywords', $venue->meta_keywords);
			$document->setDescription(strip_tags($venue->meta_description));

			// Check if the user has permission to add things
			$permissions = new stdClass();
			$permissions->canAddEvent = $user->can('add', 'event');
			$permissions->canAddVenue = $user->can('add', 'venue');

			// Check if the user has permission to edit-this venue
			$permissions->canEditVenue = $user->can('edit', 'venue', $venue->id, $venue->created_by);
			$permissions->canEditPublishVenue = $user->can(array('edit', 'publish'), 'venue', $venue->id, $venue->created_by);

			// Generate Venuedescription
			if (!$venue->locdescription == '' || !$venue->locdescription == '<br />') {
				// execute plugins
				$venue->text = $venue->locdescription;
				$venue->title = $venue->venue;
				JPluginHelper::importPlugin ('content');
				$app->triggerEvent ('onContentPrepare', array (
						'com_jem.venue',
						&$venue,
						&$params,
						0
				));
				$venuedescription = $venue->text;
			}

			// build the url
			if (!empty($venue->url) && !preg_match('%^http(s)?://%', $venue->url)) {
				$venue->url = 'http://' . $venue->url;
			}

			// prepare the url for output
			if (strlen($venue->url) > 35) {
				$venue->urlclean = $this->escape(substr($venue->url, 0, 35 )) . '...';
			} else {
				$venue->urlclean = $this->escape($venue->url);
			}

			// create flag
			if ($venue->country) {
				$venue->countryimg = JemHelperCountries::getCountryFlag($venue->country);
			}

			// Create the pagination object
			$pagination = $this->get('Pagination');

			// filters
			$filters = array ();

			// ALL events have the same venue - so hide this from filter and list
			$jemsettings->showlocate = 0;

			if ($jemsettings->showtitle == 1) {
				$filters[] = JHtml::_('select.option', '1', JText::_('COM_JEM_TITLE'));
			}
			if ($jemsettings->showlocate == 1) {
				$filters[] = JHtml::_('select.option', '2', JText::_('COM_JEM_VENUE'));
			}
			if ($jemsettings->showcity == 1) {
				$filters[] = JHtml::_('select.option', '3', JText::_('COM_JEM_CITY'));
			}
			if ($jemsettings->showcat == 1) {
				$filters[] = JHtml::_('select.option', '4', JText::_('COM_JEM_CATEGORY'));
			}
			if ($jemsettings->showstate == 1) {
				$filters[] = JHtml::_('select.option', '5', JText::_('COM_JEM_STATE'));
			}
			$lists['filter'] = JHtml::_('select.genericlist', $filters, 'filter_type', array('size'=>'1','class'=>'inputbox'), 'value', 'text', $filter_type);
			$lists['search'] = $search;

			// mapping variables
			$this->lists            = $lists;
			$this->action           = $uri->toString();
			$this->rows             = $rows;
			$this->noevents         = $noevents;
			$this->venue            = $venue;
			$this->print_link       = $print_link;
			$this->params           = $params;
			$this->limage           = $limage;
			$this->venuedescription = $venuedescription;
			$this->pagination       = $pagination;
			$this->jemsettings      = $jemsettings;
			$this->settings         = $settings;
			$this->permissions      = $permissions;
			$this->show_status      = $permissions->canEditPublishVenue;
			$this->item             = $menuitem;
			$this->pagetitle        = $pagetitle;
			$this->task             = $task;
			$this->pageclass_sfx    = htmlspecialchars($pageclass_sfx);
		}

		parent::display($tpl);
	}
Example #23
0
<?php

/**
 * @package JEM
 * @subpackage JEM - Module-Basic
 * @copyright (C) 2013-2015 joomlaeventmanager.net
 * @copyright (C) 2005-2009 Christoph Lukes
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */
defined('_JEXEC') or die;
JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_jem/models', 'JemModel');
require_once JPATH_SITE . '/components/com_jem/helpers/helper.php';
// perform cleanup if it wasn't done today (archive, trash)
JEMHelper::cleanup();
/**
 * Module-Basic
 */
abstract class modJEMHelper
{
    /**
     * Method to get the events
     *
     * @access public
     * @return array
     */
    public static function getList(&$params)
    {
        mb_internal_encoding('UTF-8');
        // Retrieve Eventslist model for the data
        $model = JModelLegacy::getInstance('Eventslist', 'JemModel', array('ignore_request' => true));
        // Set params for the model
Example #24
0
	/**
	 * Build the where clause
	 *
	 * @access private
	 * @return string
	 */
	protected function _buildVenuesWhere()
	{
		$app 			= JFactory::getApplication();
		$user 			= JemFactory::getUser();
		$settings 		= JEMHelper::globalattribs();

		$filter 		= $app->getUserStateFromRequest('com_jem.myvenues.filter', 'filter', '', 'int');
		$search 		= $app->getUserStateFromRequest('com_jem.myvenues.filter_search', 'filter_search', '', 'string');
		$search 		= $this->_db->escape(trim(JString::strtolower($search)));

		$where = array();

	//	$where[] = ' l.published = 1';

		// then if the user is creator of the event
		$where [] = ' l.created_by = '.$this->_db->Quote($user->id);

		if ($settings->get('global_show_filter') && $search) {
			switch($filter) {
				case 1:
// 					$where[] = ' LOWER(a.title) LIKE \'%'.$search.'%\' ';
					break;
				case 2:
					$where[] = ' LOWER(l.venue) LIKE \'%'.$search.'%\' ';
					break;
				case 3:
					$where[] = ' LOWER(l.city) LIKE \'%'.$search.'%\' ';
					break;
				case 4:
// 					$where[] = ' LOWER(c.catname) LIKE \'%'.$search.'%\' ';
					break;
				case 5:
				default:
					$where[] = ' LOWER(l.state) LIKE \'%'.$search.'%\' ';
			}
		}

		$where = (count($where) ? ' WHERE ' . implode(' AND ', $where) : '');

		return $where;
	}
Example #25
0
 /**
  * logic to get the categories
  *
  * @return void
  */
 public function getCategories()
 {
     $user = JFactory::getUser();
     $jemsettings = JEMHelper::config();
     $userid = (int) $user->get('id');
     $superuser = JEMUser::superuser();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select(array('c.*'));
     $query->from($db->quoteName('#__jem_categories') . ' AS c');
     $query->where(array('c.published = 1 '));
     $query->order(array('c.parent_id', 'c.ordering'));
     $db->setQuery($query);
     $mitems = $db->loadObjectList();
     # Check for a database error.
     if ($db->getErrorNum()) {
         JError::raiseNotice(500, $db->getErrorMsg());
     }
     if (!$mitems) {
         $mitems = array();
         $children = array();
         $parentid = $mitems;
     } else {
         $mitems_temp = $mitems;
         $children = array();
         # First pass - collect children
         foreach ($mitems as $v) {
             $pt = $v->parent_id;
             $list = @$children[$pt] ? $children[$pt] : array();
             array_push($list, $v);
             $children[$pt] = $list;
         }
         $parentid = intval($mitems[0]->parent_id);
     }
     # get list of the items
     $list = JemCategories::treerecurse($parentid, '', array(), $children, 9999, 0, 0);
     return $list;
 }
Example #26
0
 /**
  * Method to get venue data.
  *
  * @param integer	The id of the venue.
  * @return mixed item data object on success, false on failure.
  */
 public function getItem($itemId = null)
 {
     $jemsettings = JEMHelper::config();
     // Initialise variables.
     $itemId = (int) (!empty($itemId)) ? $itemId : $this->getState('venue.id');
     // Get a row instance.
     $table = $this->getTable();
     // Attempt to load the row.
     $return = $table->load($itemId);
     // Check for a table object error.
     if ($return === false && $table->getError()) {
         $this->setError($table->getError());
         return false;
     }
     $properties = $table->getProperties(1);
     $value = JArrayHelper::toObject($properties, 'JObject');
     // Convert attrib field to Registry.
     //$registry = new JRegistry();
     //$registry->loadString($value->attribs);
     $globalsettings = JemHelper::globalattribs();
     $globalregistry = new JRegistry();
     $globalregistry->loadString($globalsettings);
     $value->params = clone $globalregistry;
     //$value->params->merge($registry);
     // Compute selected asset permissions.
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $asset = 'com_jem.venue.' . $value->id;
     // Check general edit permission first.
     if ($user->authorise('core.edit', $asset)) {
         $value->params->set('access-edit', true);
     } elseif (!empty($userId) && $user->authorise('core.edit.own', $asset)) {
         // Check for a valid user and that they are the owner.
         if ($userId == $value->created_by) {
             $value->params->set('access-edit', true);
         }
     }
     // Check edit state permission.
     if ($itemId) {
         // Existing item
         $value->params->set('access-change', $user->authorise('core.edit.state', $asset));
     } else {
         $value->params->set('access-change', $user->authorise('core.edit.state', 'com_jem'));
     }
     $value->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false;
     $files = JemAttachment::getAttachments('venue' . $itemId);
     $value->attachments = $files;
     if (empty($itemId)) {
         $value->country = $jemsettings->defaultCountry;
     }
     if (!empty($value->locimage)) {
         if (strpos($value->locimage, 'images/') !== false) {
             # the image selected contains the images path
         } else {
             # the image selected doesn't have the /images/ path
             # we're looking at the locimage so we'll append the venues folder
             $value->locimage = 'images/jem/venues/' . $value->locimage;
         }
     }
     return $value;
 }
Example #27
0
 protected function getOptions()
 {
     // Initialise variables.
     $options = array();
     $published = $this->element['published'] ? $this->element['published'] : array(0, 1);
     $name = (string) $this->element['name'];
     $action = (string) $this->element['action'];
     $frontedit = $this->element['frontedit'];
     $jinput = JFactory::getApplication()->input;
     $db = JFactory::getDbo();
     $a_id = $jinput->get('a_id', null);
     // retrieve data
     if ($frontedit) {
         $user = JFactory::getUser();
         $jemsettings = JEMHelper::config();
         $userid = (int) $user->get('id');
         $superuser = JEMUser::superuser();
         $levels = $user->getAuthorisedViewLevels();
         $settings = JemHelper::globalattribs();
         $guestcat = $settings->get('guest_category', '0');
         $jinput = JFactory::getApplication()->input;
         $valguest = JEMUser::validate_guest();
         $name = (string) $this->element['name'];
         $db = JFactory::getDbo();
         $auth_joomlagr = $user->getAuthorisedGroups();
         $oldCat = 0;
         $query = $db->getQuery(true)->select('a.id AS value, a.catname AS text, a.level, a.published')->from('#__jem_categories AS a')->join('LEFT', $db->quoteName('#__jem_categories') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
         if (is_numeric($published)) {
             $query->where('a.published = ' . (int) $published);
         } elseif (is_array($published)) {
             JArrayHelper::toInteger($published);
             $query->where('a.published IN (' . implode(',', $published) . ')');
         }
         // specific code
         if (!$valguest) {
             $validated = false;
             if ($superuser) {
                 // no need to restrict to category's
                 $validated = true;
             }
             if (!$validated) {
                 // in this case it's going to be difficult
                 // catch the groupnumber of the user+add rights
                 $query2 = $db->getQuery(true);
                 $query2->select(array('gr.id'));
                 $query2->from($db->quoteName('#__jem_groups') . ' AS gr');
                 $query2->join('LEFT', '#__jem_groupmembers AS g ON g.group_id = gr.id');
                 $query2->where(array('g.member = ' . (int) $user->get('id'), $db->quoteName('gr.addevent') . ' =1', 'g.member NOT LIKE 0'));
                 $db->setQuery($query2);
                 $groupnumber = $db->loadColumn();
                 // is the user member of a group with edit rights?
                 if ($groupnumber) {
                     // restrict submission into maintained categories only
                     $query->where(array('a.groupid IN (' . implode(',', $groupnumber) . ')'));
                 } else {
                     return false;
                 }
             }
         } else {
             // $specified guest category
             $query->where(array('a.id = ' . $guestcat));
         }
         $query->group('a.id, a.catname, a.level, a.lft, a.rgt, a.parent_id, a.published')->order('a.lft ASC');
         $db->setQuery($query);
     }
     try {
         $options = $db->loadObjectList();
     } catch (RuntimeException $e) {
         JError::raiseWarning(500, $e->getMessage);
     }
     // Pad the option text with spaces using depth level as a multiplier.
     for ($i = 0, $n = count($options); $i < $n; $i++) {
         // remove root
         if ($this->element['removeroot'] == true) {
             if ($options[$i]->level == 0) {
                 unset($options[$i]);
                 continue;
             }
             $options[$i]->level = $options[$i]->level - 1;
         }
         if ($options[$i]->published == 1) {
             $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
         } else {
             $options[$i]->text = str_repeat('- ', $options[$i]->level) . '[' . $options[$i]->text . ']';
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Example #28
0
 /**
  * Build the where clause
  *
  * @access private
  * @return string
  */
 protected function _buildWhere()
 {
     $app = JFactory::getApplication();
     $jinput = $app->input;
     $task = $jinput->getCmd('task');
     $params = $app->getParams();
     $settings = JEMHelper::globalattribs();
     $user = JFactory::getUser();
     $levels = $user->getAuthorisedViewLevels();
     $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
     $db = JFactory::getDBO();
     $filter_type = $app->getUserStateFromRequest('com_jem.myevents.' . $itemid . '.filter_type', 'filter_type', '', 'int');
     if ($filter_type == 0) {
         $filter_type = 1;
     }
     $search = $app->getUserStateFromRequest('com_jem.myevents.' . $itemid . '.filter_search', 'filter_search', '', 'string');
     $search = $this->_db->escape(trim(JString::strtolower($search)));
     $where = array();
     // First thing we need to do is to select only needed events
     if ($task == 'archive') {
         $where[] = ' a.published = 2';
     } else {
         $where[] = ' (a.published = 1 OR a.published = 0)';
     }
     $where[] = ' c.published = 1';
     $where[] = ' c.access IN (' . implode(',', $levels) . ')';
     // then if the user is the owner of the event
     $where[] = ' a.created_by = ' . $this->_db->Quote($user->id);
     // get excluded categories
     $excluded_cats = trim($params->get('excluded_cats', ''));
     if ($excluded_cats != '') {
         $cats_excluded = explode(',', $excluded_cats);
         $where[] = '  (c.id!=' . implode(' AND c.id!=', $cats_excluded) . ')';
     }
     // === END Excluded categories add === //
     if (!empty($search)) {
         if (stripos($search, 'id:') === 0) {
             $query->where('a.id = ' . (int) substr($search, 3));
         } else {
             $search = $db->Quote('%' . $db->escape($search, true) . '%');
             if ($search && $settings->get('global_show_filter')) {
                 switch ($filter_type) {
                     case 1:
                         $where[] = ' LOWER(a.title) LIKE ' . $search;
                         break;
                     case 2:
                         $where[] = ' LOWER(l.venue) LIKE ' . $search;
                         break;
                     case 3:
                         $where[] = ' LOWER(l.city) LIKE ' . $search;
                         break;
                     case 4:
                         $where[] = ' LOWER(c.catname) LIKE ' . $search;
                         break;
                     case 5:
                     default:
                         $where[] = ' LOWER(l.state) LIKE ' . $search;
                 }
             }
         }
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     return $where;
 }
Example #29
0
	/**
	 * Prepares the print screen
	 *
	 * @param $tpl
	 */
	protected function _displayprint($tpl = null)
	{
		$document	= JFactory::getDocument();
		$app		= JFactory::getApplication();
		$params		= $app->getParams();
		$settings	= JEMHelper::globalattribs();

		// Load css
		JemHelper::loadCss('backend');
		JemHelper::loadCss('jem');
		JemHelper::loadCss('print');
		JemHelper::loadCustomTag();

		$document->setMetaData('robots', 'noindex, nofollow');

		// Emailaddress
		$enableemailaddress = $params->get('enableemailaddress', 0);

		$rows  	= $this->get('Data');
		$event 	= $this->get('Event');

		//assign data to template
		$this->rows 		= $rows;
		$this->event 		= $event;
		$this->enableemailaddress = $enableemailaddress;
		$this->settings		= $settings;

		parent::display($tpl);
	}
Example #30
0
	/**
	 * for attachment downloads
	 *
	 */
	function getfile()
	{
		$id = JFactory::getApplication()->input->getInt('file', 0);

		$path = JEMAttachment::getAttachmentPath($id);

		$mime = JEMHelper::getMimeType($path);

		$doc = JFactory::getDocument();
		$doc->setMimeEncoding($mime);
		header('Content-Disposition: attachment; filename="'.basename($path).'"');
		if ($fd = fopen ($path, "r"))
		{
			$fsize = filesize($path);
			header("Content-length: $fsize");
			header("Cache-control: private"); //use this to open files directly
			while(!feof($fd)) {
				$buffer = fread($fd, 2048);
				echo $buffer;
			}
		}
		fclose ($fd);
		return;
	}